/[ascend]/trunk/base/generic/compiler/logrelation.c
ViewVC logotype

Diff of /trunk/base/generic/compiler/logrelation.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 96 by johnpye, Wed Dec 7 15:44:43 2005 UTC revision 97 by jds, Fri Dec 9 03:49:19 2005 UTC
# Line 321  static struct logrel_term *CreateBoolVar Line 321  static struct logrel_term *CreateBoolVar
321  {  {
322    struct logrel_term *term;    struct logrel_term *term;
323    unsigned long pos;    unsigned long pos;
324    if ((pos = gl_search(g_logrelation_bvar_list,i,(CmpFunc)CmpP))){    if (0 != (pos = gl_search(g_logrelation_bvar_list,i,(CmpFunc)CmpP))){
325      /* find boolean var if already on logical relations var list */      /* find boolean var if already on logical relations var list */
326      term = POOL_ALLOCLOGTERM;      term = POOL_ALLOCLOGTERM;
327      assert(term!=NULL);      assert(term!=NULL);
# Line 367  static struct logrel_term *CreateSatisfi Line 367  static struct logrel_term *CreateSatisfi
367  {  {
368    struct logrel_term *term;    struct logrel_term *term;
369    unsigned long pos;    unsigned long pos;
370    if ((pos = gl_search(g_logrelation_satrel_list,inst,(CmpFunc)CmpP))){    if (0 != (pos = gl_search(g_logrelation_satrel_list,inst,(CmpFunc)CmpP))){
371      /* find log/relation if already on logical relations satrel list */      /* find log/relation if already on logical relations satrel list */
372      term = POOL_ALLOCLOGTERM;      term = POOL_ALLOCLOGTERM;
373      assert(term!=NULL);      assert(term!=NULL);
# Line 509  static int ConvertLogExpr(CONST struct E Line 509  static int ConvertLogExpr(CONST struct E
509        break;        break;
510      case e_var:      case e_var:
511        if (GetEvaluationForTable()!= NULL &&        if (GetEvaluationForTable()!= NULL &&
512        (str = SimpleNameIdPtr(ExprName(start)))&&        (NULL != (str = SimpleNameIdPtr(ExprName(start)))) &&
513        (fvp=FindForVar(GetEvaluationForTable(),str))){        (NULL != (fvp=FindForVar(GetEvaluationForTable(),str)))){
514      if (GetForKind(fvp)==f_integer){      if (GetForKind(fvp)==f_integer){
515        term = CreateLogIntegerTerm(GetForInteger(fvp));        term = CreateLogIntegerTerm(GetForInteger(fvp));
516        AppendLogTermBuf(term);        AppendLogTermBuf(term);
# Line 1021  void DestroyBVarList(struct gl_list_t *l Line 1021  void DestroyBVarList(struct gl_list_t *l
1021    register struct Instance *ptr;    register struct Instance *ptr;
1022    register unsigned long c;    register unsigned long c;
1023    for(c=gl_length(l);c>=1;c--)    for(c=gl_length(l);c>=1;c--)
1024      if ((ptr = (struct Instance *)gl_fetch(l,c)))      if (NULL != (ptr = (struct Instance *)gl_fetch(l,c)))
1025        RemoveLogRel(ptr,inst);        RemoveLogRel(ptr,inst);
1026    gl_destroy(l);    gl_destroy(l);
1027  }  }
# Line 1031  void DestroySatRelList(struct gl_list_t Line 1031  void DestroySatRelList(struct gl_list_t
1031    register struct Instance *ptr;    register struct Instance *ptr;
1032    register unsigned long c;    register unsigned long c;
1033    for(c=gl_length(l);c>=1;c--)    for(c=gl_length(l);c>=1;c--)
1034      if ((ptr = (struct Instance *)gl_fetch(l,c)))      if (NULL != (ptr = (struct Instance *)gl_fetch(l,c)))
1035        RemoveLogRel(ptr,inst);        RemoveLogRel(ptr,inst);
1036    gl_destroy(l);    gl_destroy(l);
1037  }  }
# Line 1164  void ModifyLogRelPointers(struct gl_list Line 1164  void ModifyLogRelPointers(struct gl_list
1164    if (old==new) return;    if (old==new) return;
1165    
1166    if (new){    if (new){
1167      if ((pos = gl_search(relorvar,old,(CmpFunc)CmpP))) {      if (0 != (pos = gl_search(relorvar,old,(CmpFunc)CmpP))) {
1168        if ((other = gl_search(relorvar,new,(CmpFunc)CmpP))){        if (0 != (other = gl_search(relorvar,new,(CmpFunc)CmpP))){
1169      gl_store(relorvar,pos,(VOIDPTR)new);     /* case 3 */      gl_store(relorvar,pos,(VOIDPTR)new);     /* case 3 */
1170          if (new == NULL) {          if (new == NULL) {
1171            inst = old;            inst = old;
# Line 1198  void ModifyLogRelPointers(struct gl_list Line 1198  void ModifyLogRelPointers(struct gl_list
1198      }      }
1199    }    }
1200    else                      /* case 4 */    else                      /* case 4 */
1201      if ((pos = gl_search(relorvar,old,(CmpFunc)CmpP)))      if (0 != (pos = gl_search(relorvar,old,(CmpFunc)CmpP)))
1202        gl_store(relorvar,pos,(VOIDPTR)new);        gl_store(relorvar,pos,(VOIDPTR)new);
1203  }  }
1204    
# Line 1231  static int CheckExprBVar(CONST struct In Line 1231  static int CheckExprBVar(CONST struct In
1231    struct Instance *inst;    struct Instance *inst;
1232    struct for_var_t *fvp;    struct for_var_t *fvp;
1233    enum find_errors err;    enum find_errors err;
1234    if((str = SimpleNameIdPtr(name))){    if(NULL != (str = SimpleNameIdPtr(name))){
1235      if (TempExists(str)) {      if (TempExists(str)) {
1236        if (ValueKind(TempValue(str))==integer_value) {        if (ValueKind(TempValue(str))==integer_value) {
1237      return 1;      return 1;
# Line 1240  static int CheckExprBVar(CONST struct In Line 1240  static int CheckExprBVar(CONST struct In
1240        }        }
1241      }      }
1242      if (GetEvaluationForTable() != NULL &&      if (GetEvaluationForTable() != NULL &&
1243          (fvp=FindForVar(GetEvaluationForTable(),str)) ) {          (NULL != (fvp=FindForVar(GetEvaluationForTable(),str))) ) {
1244        if (GetForKind(fvp)==f_integer) {        if (GetForKind(fvp)==f_integer) {
1245      return 1;      return 1;
1246        } else {        } else {

Legend:
Removed from v.96  
changed lines
  Added in v.97

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22