Changeset 7604db in git for Singular/lists.cc


Ignore:
Timestamp:
Apr 19, 1999, 1:03:57 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
228c7e51151a4fc3bdf6908acbb09367f243d275
Parents:
a30caa3e79912e5d42b9d62c6d2e1aa1239e5486
Message:
* print command


git-svn-id: file:///usr/local/Singular/svn/trunk@2992 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/lists.cc

    ra30caa3 r7604db  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: lists.cc,v 1.14 1999-04-17 14:58:51 obachman Exp $ */
     4/* $Id: lists.cc,v 1.15 1999-04-19 11:02:40 obachman Exp $ */
    55/*
    66* ABSTRACT: handling of the list type
     
    356356char* lString(lists l, BOOLEAN typed, int dim)
    357357{
    358   if (l->nr == -1) return mstrdup("");
     358  if (l->nr == -1)
     359  {
     360    if (typed) return mstrdup("list()");
     361    return mstrdup("");
     362  }
     363 
    359364  char** slist = (char**) Alloc((l->nr+1) * sizeof(char*));
    360365  int i, j, k;
     
    362367  for (i=0, j = 0, k = 0; i<=l->nr; i++)
    363368  {
    364     slist[i] = l->m[i].String();
     369    slist[i] = l->m[i].String(NULL, typed, dim);
    365370    assume(slist[i] != NULL);
     371    mmTestL(slist[i]);
    366372    if (*(slist[i]) != '\0')
    367373    {
     
    370376    }
    371377  }
    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
    374385  for (i=0; i<=l->nr; i++)
    375386  {
     
    378389      strcat(s, slist[i]);
    379390      strcat(s, ",");
    380     }
     391      if (dim == 2) strcat(s, "\n");
     392    }
     393    mmTestL(s);
    381394    FreeL(slist[i]);
    382395  }
    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);
    384399  Free(slist, (l->nr+1) * sizeof(char*));
    385400  return s;
Note: See TracChangeset for help on using the changeset viewer.