Annotation of OpenXM/src/k097/lib/tostr.ccc, Revision 1.1
1.1 ! maekawa 1: /* lib/tostr.ccc : to generate sm1-package tostr.sm1 */
! 2: /* The contents of this file is moved to slib.ccc.
! 3: The name of the function is changed to ToString. */
! 4: sm1(" 0 @@@.indexMode "); /* C-like notation of matrix. a[0], ... */
! 5:
! 6: def tostr2(p) {
! 7: local n,ans,i;
! 8: ans = [ ];
! 9: if (IsArray(p)) {
! 10: n = Length(p);
! 11: ans = Append(ans,"[ ");
! 12: for (i=0; i<n; i++) {
! 13: ans = Append(ans,tostr2(p[i]));
! 14: if (i != n-1) {
! 15: ans = Append(ans," , ");
! 16: }
! 17: }
! 18: ans = Append(ans," ] ");
! 19: } else {
! 20: ans = [ sm1(p," (dollar) dc ") ];
! 21: /* Println(ans); */
! 22: }
! 23: return(AddString(ans));
! 24: }
! 25:
! 26: def IsArray(p) {
! 27: sm1(p," isArray /FunctionValue set ");
! 28: }
! 29:
! 30:
! 31: /* Println(tostr2([1,[2,3,4]])); */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>