Changeset ed47aab in git


Ignore:
Timestamp:
Aug 1, 2012, 11:02:34 PM (10 years ago)
Author:
Alexander Dreyer <alexander.dreyer@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '96ce329119711a2b80858c8365abd29f8460bbfa')
Children:
eff32475b39858b9ea00d1f210285e77a6d485d1
Parents:
3d69257fe19a1e388e6e33fc7381ea50cf3041cb
Message:
new: newstruct_desc can be utilized by non-newstruc custom types
Location:
Singular
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/newstruct.cc

    r3d69257 red47aab  
    158158          l->rtyp=r->Typ();
    159159        }
     160      }
     161      else                      // unrelated types - look for custom conversion
     162      {
     163        sleftv tmp;
     164        BOOLEAN newstruct_Op1(int, leftv, leftv);  // forward declaration
     165        if (! newstruct_Op1(l->Typ(), &tmp, r))  return newstruct_Assign(l, &tmp);
    160166      }
    161167    }
     
    607613   return NULL;
    608614}
    609 newstruct_desc newstructFromString(const char *s)
     615
     616newstruct_desc newstructDesc()
    610617{
    611618  newstruct_desc res=(newstruct_desc)omAlloc0(sizeof(*res));
    612619  res->size=0;
    613 
    614   return scanNewstructFromString(s,res);
    615 }
     620  return res;
     621}
     622
     623newstruct_desc newstructFromString(const char *s)
     624{
     625  return scanNewstructFromString(s, newstructDesc());
     626}
     627
    616628newstruct_desc newstructChildFromString(const char *parent, const char *s)
    617629{
  • Singular/newstruct.h

    r3d69257 red47aab  
    55
    66void newstruct_setup(const char * name, newstruct_desc d);
     7newstruct_desc newstructDesc();
    78newstruct_desc newstructFromString(const char *s);
    89newstruct_desc newstructChildFromString(const char *p, const char *s);
    910BOOLEAN newstruct_set_proc(const char *name,const char *func,int args, procinfov p);
    1011void newstructShow(newstruct_desc d);
    11 
    1212#endif
  • Singular/pyobject.cc

    r3d69257 red47aab  
    521521  }
    522522
     523  if (op > MAX_TOK)       // custom types
     524  {
     525    BOOLEAN newstruct_Op1(int, leftv, leftv);
     526    if (! newstruct_Op1(op, res, head) ) return FALSE;
     527  }
     528
    523529  return PythonCastStatic<>(head)(op).assign_to(res);
    524530}
     
    646652  b->blackbox_Op3     = pyobject_Op3;
    647653  b->blackbox_OpM     = pyobject_OpM;
     654  b->data = newstructDesc();
    648655
    649656  PythonInterpreter::init(setBlackboxStuff(b,"pyobject"));
Note: See TracChangeset for help on using the changeset viewer.