Changeset a04a05 in git
- Timestamp:
- Aug 1, 2012, 11:29:10 PM (11 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 29fc84389b9713cdf07cc538bad5becf4758553e
- Parents:
- 5ebd4bcf7ead1b205b12afeec0793f8bc29e16ec
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/newstruct.cc
r5ebd4bc ra04a05 134 134 } 135 135 136 // Used by newstruct_Assign for overloaded '=' 137 BOOLEAN newstruct_equal(int op, leftv l, leftv r) 138 { 139 blackbox *ll=getBlackboxStuff(op); 140 assume(ll->data != NULL); 141 newstruct_desc nt=(newstruct_desc)ll->data; 142 newstruct_proc p=nt->procs; 143 144 while( (p!=NULL) && ((p->t!='=')||(p->args!=1)) ) p=p->next; 145 146 if (p!=NULL) 147 { 148 idrec hh; 149 memset(&hh,0,sizeof(hh)); 150 hh.id=Tok2Cmdname(p->t); 151 hh.typ=PROC_CMD; 152 hh.data.pinf=p->p; 153 sleftv tmp; 154 memset(&tmp,0,sizeof(sleftv)); 155 tmp.Copy(r); 156 leftv sl = iiMake_proc(&hh, NULL, &tmp); 157 if (sl != NULL) 158 { 159 if (sl->Typ() == op) { l->Copy(sl); return FALSE;} 160 else sl->CleanUp(); 161 } 162 } 163 return TRUE; 164 } 165 136 166 BOOLEAN newstruct_Assign(leftv l, leftv r) 137 167 { … … 193 223 else if(l->Typ() > MAX_TOK) 194 224 { 195 blackbox *ll=getBlackboxStuff(l->Typ()); 196 newstruct_desc nt=(newstruct_desc)ll->data; 197 newstruct_proc p=nt->procs; 198 199 while( (p!=NULL) && ((p->t!='=')||(p->args!=1)) ) p=p->next; 200 201 if (p!=NULL) 202 { 203 idrec hh; 204 memset(&hh,0,sizeof(hh)); 205 hh.id=Tok2Cmdname(p->t); 206 hh.typ=PROC_CMD; 207 hh.data.pinf=p->p; 208 sleftv tmp; 209 memset(&tmp,0,sizeof(sleftv)); 210 tmp.Copy(r); 211 leftv sl = iiMake_proc(&hh, NULL, &tmp); 212 if (sl != NULL) 213 { 214 if (sl->Typ()==l->Typ()) return newstruct_Assign(l, sl); 215 else sl->CleanUp(); 216 } 217 } 225 assume(l->Typ() > MAX_TOK); 226 sleftv tmp; 227 if(!newstruct_equal(l->Typ(), &tmp, r)) return newstruct_Assign(l, &tmp); 218 228 } 219 229 Werror("assign %s(%d) = %s(%d)", -
Singular/pyobject.cc
r5ebd4bc ra04a05 339 339 } 340 340 341 sleftv tmp; 342 BOOLEAN newstruct_equal(int, leftv, leftv); // declaring overloaded '=' 343 if (!newstruct_equal(PythonInterpreter::id(), &tmp, value)) 344 return PythonCastStatic<>(&tmp); 345 341 346 if (typeId > MAX_TOK) // custom types 342 347 { 343 348 blackbox *bbx = getBlackboxStuff(typeId); 344 sleftv tmp; 345 if (! bbx->blackbox_Op1(PythonInterpreter::id(), &tmp, value) ) 346 return PythonCastStatic<>(&tmp); 347 } 348 else 349 Werror("type '%s` incompatible with 'pyobject`", iiTwoOps(typeId)); 350 349 assume(bbx != NULL); 350 if (! bbx->blackbox_Op1(PythonInterpreter::id(), &tmp, value)) 351 return PythonCastStatic<>(&tmp); 352 } 353 354 Werror("type '%s` incompatible with 'pyobject`", iiTwoOps(typeId)); 351 355 return PythonObject(); 352 356 }
Note: See TracChangeset
for help on using the changeset viewer.