Changeset 8db6c3 in git
- Timestamp:
- Feb 16, 2011, 2:27:50 PM (13 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 74a04c7beedec063e096ede7db7df150693f87b2
- Parents:
- f2df0c30be0677407fbe248dc749715bf5ec0e7f
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/blackbox.h
rf2df0c3 r8db6c3 38 38 void *data; 39 39 /// addtinional gneral properties 40 char like_lists; // 1:blackbox is only a wrapper for lists 40 int properties; // bit 0:blackbox is only a wrapper for lists 41 #define BB_LIKE_LIST(B) ((B)->properties &1) 41 42 } ; 42 43 /// default procedure blackboxDefaultOp1, to be called as "default:" branch -
Singular/ipassign.cc
rf2df0c3 r8db6c3 1433 1433 { 1434 1434 /* l[..] = ... */ 1435 if((l->e!=NULL) 1436 && (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD)) 1437 || (l->rtyp==LIST_CMD))) 1438 { 1439 if (TEST_V_ALLWARN) PrintS("assign list[..]=...\n"); 1440 b=jiAssign_list(l,r); 1441 if(!b) 1442 { 1443 //Print("jjA_L_LIST: - 2 \n"); 1444 if((l->rtyp==IDHDL) && (l->data!=NULL)) 1445 { 1446 ipMoveId((idhdl)l->data); 1447 l->attribute=IDATTR((idhdl)l->data); 1448 l->flag=IDFLAG((idhdl)l->data); 1449 } 1450 } 1451 r->CleanUp(); 1452 Subexpr h; 1453 while (l->e!=NULL) 1454 { 1455 h=l->e->next; 1456 omFreeBin((ADDRESS)l->e, sSubexpr_bin); 1457 l->e=h; 1458 } 1459 return b; 1460 } 1435 if(l->e!=NULL) 1436 { 1437 BOOLEAN like_lists=0; 1438 blackbox *bb=NULL; 1439 int bt; 1440 if (((bt=l->rtyp)>MAX_TOK) 1441 || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK))) 1442 { 1443 bb=getBlackboxStuff(bt); 1444 like_lists=BB_LIKE_LIST(bb); 1445 } 1446 else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD)) 1447 || (l->rtyp==LIST_CMD)) 1448 { 1449 like_lists=2; 1450 } 1451 if(like_lists) 1452 { 1453 if (TEST_V_ALLWARN) PrintS("assign list[..]=...or similiar\n"); 1454 b=jiAssign_list(l,r); 1455 if((!b) && (like_lists==2)) 1456 { 1457 //Print("jjA_L_LIST: - 2 \n"); 1458 if((l->rtyp==IDHDL) && (l->data!=NULL)) 1459 { 1460 ipMoveId((idhdl)l->data); 1461 l->attribute=IDATTR((idhdl)l->data); 1462 l->flag=IDFLAG((idhdl)l->data); 1463 } 1464 } 1465 r->CleanUp(); 1466 Subexpr h; 1467 while (l->e!=NULL) 1468 { 1469 h=l->e->next; 1470 omFreeBin((ADDRESS)l->e, sSubexpr_bin); 1471 l->e=h; 1472 } 1473 if ((!b) && (like_lists==1)) 1474 { 1475 // check blackbox/newtype type: 1476 if(bb->blackbox_Check(bb,l->Data())) return TRUE; 1477 } 1478 return b; 1479 } 1480 } 1481 // end of handling elems of list and similiar 1461 1482 rl=r->listLength(); 1462 1483 if (rl==1) -
Singular/subexpr.cc
rf2df0c3 r8db6c3 1030 1030 r=STRING_CMD; 1031 1031 break; 1032 case LIST_CMD: 1033 { 1034 lists l; 1035 if (rtyp==IDHDL) l=IDLIST((idhdl)data); 1036 else l=(lists)data; 1037 if ((0<e->start)&&(e->start<=l->nr+1)) 1038 { 1039 Subexpr tmp=l->m[e->start-1].e; 1040 l->m[e->start-1].e=e->next; 1041 r=l->m[e->start-1].Typ(); 1042 e->next=l->m[e->start-1].e; 1043 l->m[e->start-1].e=tmp; 1032 default: 1033 { 1034 blackbox *b=NULL; 1035 if (t>MAX_TOK) 1036 { 1037 b=getBlackboxStuff(t); 1038 } 1039 if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b))) 1040 { 1041 lists l; 1042 if (rtyp==IDHDL) l=IDLIST((idhdl)data); 1043 else l=(lists)data; 1044 if ((0<e->start)&&(e->start<=l->nr+1)) 1045 { 1046 Subexpr tmp=l->m[e->start-1].e; 1047 l->m[e->start-1].e=e->next; 1048 r=l->m[e->start-1].Typ(); 1049 e->next=l->m[e->start-1].e; 1050 l->m[e->start-1].e=tmp; 1051 } 1052 else 1053 { 1054 //Warn("out of range: %d not in 1..%d",e->start,l->nr+1); 1055 r=NONE; 1056 } 1044 1057 } 1045 1058 else 1046 { 1047 //Warn("out of range: %d not in 1..%d",e->start,l->nr+1); 1048 r=NONE; 1049 } 1059 Werror("cannot index type %s(%d)",Tok2Cmdname(t),t); 1050 1060 break; 1051 1061 } 1052 default:1053 Werror("cannot index type %d",t);1054 1062 } 1055 1063 return r; … … 1248 1256 break; 1249 1257 } 1250 case LIST_CMD: 1251 { 1252 lists l=(lists)d; 1253 if ((0<index)&&(index<=l->nr+1)) 1254 { 1255 if ((e->next!=NULL) 1256 && (l->m[index-1].rtyp==STRING_CMD)) 1257 // string[..].Data() modifies sleftv, so let's do it ourself 1258 { 1259 char *dd=(char *)l->m[index-1].data; 1260 int j=e->next->start-1; 1261 r=(char *)omAllocBin(size_two_bin); 1262 if ((j>=0) && (j<(int)strlen(dd))) 1263 { 1264 r[0]=*(dd+j); 1265 r[1]='\0'; 1258 default: 1259 { 1260 blackbox *b=NULL; 1261 if (t>MAX_TOK) 1262 { 1263 b=getBlackboxStuff(t); 1264 } 1265 if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b)))) 1266 { 1267 lists l=(lists)d; 1268 if ((0<index)&&(index<=l->nr+1)) 1269 { 1270 if ((e->next!=NULL) 1271 && (l->m[index-1].rtyp==STRING_CMD)) 1272 // string[..].Data() modifies sleftv, so let's do it ourself 1273 { 1274 char *dd=(char *)l->m[index-1].data; 1275 int j=e->next->start-1; 1276 r=(char *)omAllocBin(size_two_bin); 1277 if ((j>=0) && (j<(int)strlen(dd))) 1278 { 1279 r[0]=*(dd+j); 1280 r[1]='\0'; 1281 } 1282 else 1283 { 1284 r[0]='\0'; 1285 } 1266 1286 } 1267 1287 else 1268 1288 { 1269 r[0]='\0'; 1270 } 1271 } 1272 else 1273 { 1274 Subexpr tmp=l->m[index-1].e; 1275 l->m[index-1].e=e->next; 1276 r=(char *)l->m[index-1].Data(); 1277 e->next=l->m[index-1].e; 1278 l->m[index-1].e=tmp; 1279 } 1280 } 1281 else //if (!errorreported) 1282 Werror("wrong range[%d] in list(%d)",index,l->nr+1); 1289 Subexpr tmp=l->m[index-1].e; 1290 l->m[index-1].e=e->next; 1291 r=(char *)l->m[index-1].Data(); 1292 e->next=l->m[index-1].e; 1293 l->m[index-1].e=tmp; 1294 } 1295 } 1296 else //if (!errorreported) 1297 Werror("wrong range[%d] in list(%d)",index,l->nr+1); 1298 } 1299 else 1300 Werror("cannot index type %s(%d)",Tok2Cmdname(t),t); 1283 1301 break; 1284 1302 } 1285 #ifdef TEST1286 default:1287 Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);1288 #endif1289 1303 } 1290 1304 return r;
Note: See TracChangeset
for help on using the changeset viewer.