Changeset 3aa622a in git for Singular/attrib.cc


Ignore:
Timestamp:
Aug 14, 2009, 2:43:18 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
1cdea1474eb911057f6a4df3eaecab9f8395417b
Parents:
5d51ebca9405eec278f66c54d48b99b74b78425c
Message:
*hannes: attribute(INTMAT), trac 158


git-svn-id: file:///usr/local/Singular/svn/trunk@12068 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/attrib.cc

    r5d51ebc r3aa622a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: attrib.cc,v 1.34 2009-05-05 09:54:38 Singular Exp $ */
     4/* $Id: attrib.cc,v 1.35 2009-08-14 12:43:18 Singular Exp $ */
    55
    66/*
     
    5555//}
    5656
     57static void attr_free(attr h, const ring r=currRing)
     58{
     59  switch (h->atyp)
     60  {
     61  case INTVEC_CMD:
     62  case INTMAT_CMD:
     63    delete (intvec *)(h->data);
     64    break;
     65  case IDEAL_CMD:
     66  case MODUL_CMD:
     67  case MATRIX_CMD:
     68    id_Delete((ideal *)&(h->data),r);
     69    break;
     70  case POLY_CMD:
     71  case VECTOR_CMD:
     72    p_Delete((poly *)&(h->data),r);
     73    break;
     74  case INT_CMD:
     75    break;
     76  case STRING_CMD:
     77    omFree((ADDRESS)(h->data));
     78    break;
     79#ifdef TEST
     80  default:
     81    ::Print("atKill: unknown type(%d)\n",h->atyp);  /* DEBUG */
     82#endif
     83  } /* end switch: (atyp) */
     84  h->data=NULL;
     85}
     86
    5787attr sattr::set(const char * s, void * data, int t)
    5888{
    5989  attr h = get(s);
     90  attr result=this;
    6091  if (h!=NULL)
    6192  {
    62     switch (h->atyp)
    63     {
    64     case INTVEC_CMD:
    65       delete (intvec *)h->data;
    66       break;
    67     case IDEAL_CMD:
    68     case MODUL_CMD:
    69     case MATRIX_CMD:
    70       idDelete((ideal *)&h->data);
    71       break;
    72     case POLY_CMD:
    73     case VECTOR_CMD:
    74       pDelete((poly *)&h->data);
    75       break;
    76     case INT_CMD:
    77       break;
    78     case STRING_CMD:
    79       omFree((ADDRESS)h->data);
    80       break;
    81 #ifdef TEST
    82     default:
    83       ::Print("at-set: unknown type(%d)\n",atyp);  /* DEBUG */
    84 #endif
    85     } /* end switch: (atyp) */
    86     omFree((ADDRESS)s);
    87   }
    88   else
    89   {
    90      h = (attr)omAlloc0Bin(sattr_bin);
    91      h->name = s;
    92      h->next = this;
    93      h->data = data;
    94      h->atyp = t;
    95      return  h;
    96   }
    97   //::Print("set attr >>%s<< of type %d\n",h->name,t);
     93    attr_free(h);
     94  }
     95  else
     96  {
     97    h = (attr)omAlloc0Bin(sattr_bin);
     98    h->next = this;
     99    result=h;
     100  }
     101  h->name = s;
    98102  h->data = data;
    99103  h->atyp = t;
    100   return  this;
     104  //::Print("set attr >>%s<< of type %d\n",h->name,t);
     105  return  result;
    101106}
    102107
     
    198203  omFree((ADDRESS)name);
    199204  name=NULL;
    200   switch (atyp)
    201   {
    202   case INTVEC_CMD:
    203     delete (intvec *)data;
    204     break;
    205   case IDEAL_CMD:
    206   case MODUL_CMD:
    207   case MATRIX_CMD:
    208     id_Delete((ideal *)&data,r);
    209     break;
    210   case POLY_CMD:
    211   case VECTOR_CMD:
    212     p_Delete((poly *)&data,r);
    213     break;
    214   case INT_CMD:
    215     break;
    216   case STRING_CMD:
    217     omFree((ADDRESS)data);
    218     break;
    219 #ifdef TEST
    220   default:
    221     ::Print("atKill: unknown type(%d)\n",atyp);  /* DEBUG */
    222 #endif
    223   } /* end switch: (atyp) */
    224   data=NULL;
     205  attr_free(this,r);
    225206  omFreeBin((ADDRESS)this, sattr_bin);
    226207}
     
    274255  }
    275256  attr at=v->attribute;
     257  BOOLEAN haveNoAttribute=TRUE;
    276258  if (hasFlag(v,FLAG_STD))
    277259  {
    278260    PrintS("attr:isSB, type int\n");
    279     if (at!=NULL) at->Print();
     261    haveNoAttribute=FALSE;
    280262  }
    281263  else if (((t=v->Typ())==RING_CMD)||(t==QRING_CMD))
    282264  {
    283265    PrintS("attr:global, type int\n");
    284     if (at!=NULL) at->Print();
    285   }
    286   else
    287   {
    288     if (at!=NULL) at->Print();
    289     else          PrintS("no attributes\n");
    290   }
     266    haveNoAttribute=FALSE;
     267  }
     268  if (at!=NULL)                    at->Print();
     269  else  if(haveNoAttribute)        PrintS("no attributes\n");
    291270  return FALSE;
    292271}
     
    450429  return FALSE;
    451430}
     431
Note: See TracChangeset for help on using the changeset viewer.