|
|
1.1 ! root 1: #include "decl.h" ! 2: ! 3: ostream& mel:: ! 4: print (ostream& o) ! 5: { ! 6: o << p; ! 7: if (s.length() != 0) ! 8: o << " " << s; ! 9: o << "\n"; ! 10: ! 11: String_list_iterator si (q); ! 12: String x; ! 13: ! 14: while (si.nextX (x)) ! 15: o << "\t" << x << "\n"; ! 16: ! 17: return o; ! 18: } ! 19: ! 20: ostream& map:: ! 21: print (ostream& o) ! 22: { ! 23: mel_list_iterator mi (l); ! 24: mel m; ! 25: ! 26: while (mi.nextX (m)) ! 27: m.print (o); ! 28: return o; ! 29: ! 30: } ! 31: ! 32: istream& map:: ! 33: read (istream& i) ! 34: { ! 35: l = mel_list(); ! 36: mel m; ! 37: String s; ! 38: ! 39: while (s = sgets (i), i.good()) { ! 40: if (s.length() != 0) { ! 41: if (s[0] == '\t') ! 42: m.q.put (s (1, s.length() - 1)); ! 43: else { ! 44: if (m.p.length() != 0) ! 45: l.put (m); ! 46: int n = s.strchr (' '); ! 47: if (n >= 0) { ! 48: m.s = s (n + 1, s.length() - n - 1); ! 49: s = s (0, n); ! 50: } else ! 51: m.s = ""; ! 52: m.p = s; ! 53: m.q = String_list(); ! 54: } ! 55: } ! 56: } ! 57: ! 58: if (m.p.length() != 0) ! 59: l.put (m); ! 60: ! 61: return i; ! 62: } ! 63: ! 64: String ! 65: logname() ! 66: { ! 67: char buf[64]; ! 68: for (int i = 0; i < sizeof (buf); i++) ! 69: buf[i] = '\0'; ! 70: if (getlogname (buf) == 0) ! 71: return buf; ! 72: return ""; ! 73: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.