[BACK]Return to tostr.ccc CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / lib

File: [local] / OpenXM / src / k097 / lib / Attic / tostr.ccc (download)

Revision 1.1.1.1 (vendor branch), Fri Oct 8 02:12:15 1999 UTC (24 years, 9 months ago) by maekawa
Branch: OpenXM
CVS Tags: maekawa-ipv6, RELEASE_20000124, RELEASE_1_1_3, RELEASE_1_1_2, ALPHA
Changes since 1.1: +0 -0 lines

o import OpenXM sources

/* lib/tostr.ccc :  to generate sm1-package tostr.sm1 */
/* The contents of this file is moved to slib.ccc.
   The name of the function is changed to ToString. */
sm1(" 0 @@@.indexMode ");  /* C-like notation of matrix. a[0], ... */

def tostr2(p) {
  local n,ans,i;
  ans = [ ];
  if (IsArray(p)) {
    n = Length(p);
    ans = Append(ans,"[ ");
    for (i=0; i<n; i++) {
      ans = Append(ans,tostr2(p[i]));
      if (i != n-1) {
        ans = Append(ans," , ");
      }
    }
    ans = Append(ans," ] ");
  } else {
    ans = [ sm1(p," (dollar) dc ") ];
    /* Println(ans);   */
  }   
  return(AddString(ans));
}

def IsArray(p) {
  sm1(p," isArray /FunctionValue set  ");
}


/* Println(tostr2([1,[2,3,4]])); */