Changeset 7604db in git for Singular/lists.cc
- Timestamp:
- Apr 19, 1999, 1:03:57 PM (24 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 228c7e51151a4fc3bdf6908acbb09367f243d275
- Parents:
- a30caa3e79912e5d42b9d62c6d2e1aa1239e5486
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/lists.cc
ra30caa3 r7604db 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: lists.cc,v 1.1 4 1999-04-17 14:58:51obachman Exp $ */4 /* $Id: lists.cc,v 1.15 1999-04-19 11:02:40 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: handling of the list type … … 356 356 char* lString(lists l, BOOLEAN typed, int dim) 357 357 { 358 if (l->nr == -1) return mstrdup(""); 358 if (l->nr == -1) 359 { 360 if (typed) return mstrdup("list()"); 361 return mstrdup(""); 362 } 363 359 364 char** slist = (char**) Alloc((l->nr+1) * sizeof(char*)); 360 365 int i, j, k; … … 362 367 for (i=0, j = 0, k = 0; i<=l->nr; i++) 363 368 { 364 slist[i] = l->m[i].String( );369 slist[i] = l->m[i].String(NULL, typed, dim); 365 370 assume(slist[i] != NULL); 371 mmTestL(slist[i]); 366 372 if (*(slist[i]) != '\0') 367 373 { … … 370 376 } 371 377 } 372 s = (char*) AllocL(j+k+1); 373 *s = '\0'; 378 s = (char*) AllocL(j+k+2+(typed ? 10 : 0) + (dim == 2 ? k : 0)); 379 380 if (typed) 381 sprintf(s, "list("); 382 else 383 *s = '\0'; 384 374 385 for (i=0; i<=l->nr; i++) 375 386 { … … 378 389 strcat(s, slist[i]); 379 390 strcat(s, ","); 380 } 391 if (dim == 2) strcat(s, "\n"); 392 } 393 mmTestL(s); 381 394 FreeL(slist[i]); 382 395 } 383 if (k > 0) s[strlen(s) - 1] = '\0'; 396 if (k > 0) s[strlen(s) - (dim == 2 ? 2 : 1)] = '\0'; 397 if (typed) strcat(s, ")"); 398 mmTestL(s); 384 399 Free(slist, (l->nr+1) * sizeof(char*)); 385 400 return s;
Note: See TracChangeset
for help on using the changeset viewer.