Changeset 769a27 in git
- Timestamp:
- Apr 24, 2015, 11:04:41 AM (8 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 20f29bb8cb76fe2c06f278317d3df2c5d344e796
- Parents:
- dabe36d14b912971b3ee9a07d9d75e0ad989dc13
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/pyobject/pyobject.cc
rdabe36d r769a27 358 358 359 359 sleftv tmp; 360 BOOLEAN newstruct_ equal(int, leftv, leftv); // declaring overloaded '='361 if (!newstruct_ equal(PythonInterpreter::id(), &tmp, value))360 BOOLEAN newstruct_Assign_user(int, leftv, leftv); // declaring overloaded '=' 361 if (!newstruct_Assign_user(PythonInterpreter::id(), &tmp, value)) 362 362 return PythonCastStatic<>(&tmp); 363 363 -
Singular/newstruct.cc
rdabe36d r769a27 166 166 167 167 // Used by newstruct_Assign for overloaded '=' 168 BOOLEAN newstruct_ equal(int op, leftv l, leftv r)168 BOOLEAN newstruct_Assign_user(int op, leftv l, leftv r) 169 169 { 170 170 blackbox *ll=getBlackboxStuff(op); … … 222 222 } 223 223 224 static BOOLEAN newstruct_Assign_same(leftv l, leftv r) 225 { 226 assume(l->Typ() == r->Typ()); 227 if (l->Data()!=NULL) 228 { 229 lists n1=(lists)l->Data(); 230 lClean_newstruct(n1); 231 } 232 lists n2=(lists)r->Data(); 233 n2=lCopy_newstruct(n2); 234 r->CleanUp(); 235 if (l->rtyp==IDHDL) 236 { 237 IDDATA((idhdl)l->data)=(char *)n2; 238 } 239 else 240 { 241 l->data=(void *)n2; 242 } 243 return FALSE; 244 } 245 224 246 BOOLEAN newstruct_Assign(leftv l, leftv r) 225 247 { 248 assume(l->Typ() > MAX_TOK); 249 if (l->Typ()==r->Typ()) 250 { 251 return newstruct_Assign_same(l,r); 252 } 253 // is there an overloading '=' ? 254 sleftv tmp; 255 if(!newstruct_Assign_user(l->Typ(), &tmp, r)) return newstruct_Assign(l, &tmp); 256 // not, try to find an equal type or parent newstruct 226 257 if (r->Typ()>MAX_TOK) 227 258 { … … 257 288 if (! newstruct_Op1(l->Typ(), &tmp, r)) return newstruct_Assign(l, &tmp); 258 289 } 259 } 260 if (l->Typ()==r->Typ()) 261 { 262 if (l->Data()!=NULL) 263 { 264 lists n1=(lists)l->Data(); 265 lClean_newstruct(n1); 266 } 267 lists n2=(lists)r->Data(); 268 n2=lCopy_newstruct(n2); 269 r->CleanUp(); 270 if (l->rtyp==IDHDL) 271 { 272 IDDATA((idhdl)l->data)=(char *)n2; 273 } 274 else 275 { 276 l->data=(void *)n2; 277 } 278 return FALSE; 279 } 280 } 281 else 282 { 283 assume(l->Typ() > MAX_TOK); 284 sleftv tmp; 285 if(!newstruct_equal(l->Typ(), &tmp, r)) return newstruct_Assign(l, &tmp); 290 if (l->Typ()==r->Typ()) 291 return newstruct_Assign_same(l,r); 292 } 286 293 } 287 294 Werror("assign %s(%d) = %s(%d)",
Note: See TracChangeset
for help on using the changeset viewer.