Annotation of researchv10no/cmd/asd++/decl.h, revision 1.1

1.1     ! root        1: #include <String.h>
        !             2: #include <list.h>
        !             3: 
        !             4: extern "C" {
        !             5:        extern char *getenv(char *);
        !             6:        extern int mkdir (char*, int);
        !             7:        extern int rmdir (char*);
        !             8:        int sleep (int);
        !             9:        extern int getlogname (char*);
        !            10: }
        !            11: 
        !            12: int mkdir (const String&, int);
        !            13: int rmdir (const String&);
        !            14: 
        !            15: 
        !            16: // decl.c
        !            17: 
        !            18: listdeclare (String)
        !            19: 
        !            20: struct mel {
        !            21:        String p;
        !            22:        String_list q;
        !            23:        String s;
        !            24:        bit operator== (const mel& x) const
        !            25:                { return p == x.p && q == x.q && s == x.s; }
        !            26:        ostream& print (ostream&);
        !            27: };
        !            28: 
        !            29: listdeclare (mel)
        !            30: 
        !            31: struct map {
        !            32:        mel_list l;
        !            33:        ostream& print (ostream&);
        !            34:        istream& read (istream&);
        !            35: };
        !            36: 
        !            37: inline ostream& operator<< (ostream& o, map& m) { return m.print (o); }
        !            38: inline istream& operator>> (istream& i, map& m) { return m.read (i); }
        !            39: 
        !            40: String logname();
        !            41: 
        !            42: class charstr {
        !            43:        char* p;
        !            44: public:
        !            45:        charstr (String s) {
        !            46:                p = new char[s.length() + 1];
        !            47:                s.dump (p);
        !            48:        }
        !            49:        ~charstr() { delete p; }
        !            50:        operator char*() { return p; };
        !            51: private:
        !            52:        charstr(const charstr&);
        !            53:        void operator=(const charstr&);
        !            54: };
        !            55: 
        !            56: // path.c
        !            57: 
        !            58: String pathnorm (String);
        !            59: 
        !            60: class Path {
        !            61:        String s;
        !            62:        friend Path mkpath(String);
        !            63: public:
        !            64:        Path() {}
        !            65:        Path(const Path& p): s (p.s) {}
        !            66:        Path(const String& st): s (pathnorm (st)) {}
        !            67:        Path(const char *cp): s (pathnorm (String (cp))) {}
        !            68:        Path& operator = (const Path& p) { s = p.s; return *this; }
        !            69:        Path operator + (const Path& p) const { return s + p.s; }
        !            70:        Path operator + (char *cp) const { return s + pathnorm (cp); }
        !            71:        friend Path operator + (char *p, const Path& q)
        !            72:                { return Path (p) + q; }
        !            73:        Path& operator += (const Path& p) { s += Path(p.s); return *this; }
        !            74:        Path operator & (const Path&) const;
        !            75:        Path operator & (const String& s) const { return *this & Path(s); }
        !            76:        Path operator & (const char *cp) const { return *this & Path (cp); }
        !            77:        friend Path operator & (const char *p, Path q)
        !            78:                { return Path (p) & q; }
        !            79:        friend Path operator & (const char *p, String q)
        !            80:                { return Path (p) & Path(q); }
        !            81:        friend Path operator & (const String& p, char* q)
        !            82:                { return Path(p) & q; }
        !            83:        Path& operator &= (const Path& p) { *this = *this & p; return *this; }
        !            84:        operator String () const { return s; }
        !            85:        Path first() const;
        !            86:        Path last() const;
        !            87:        Path rmfirst() const;
        !            88:        Path rmlast() const;
        !            89:        friend ostream& operator <<(ostream&, const Path&);
        !            90:        int operator < (const Path& t) const { return s < t.s; }
        !            91:        int operator > (const Path& t) const { return s > t.s; }
        !            92:        int operator <= (const Path& t) const { return s <= t.s; }
        !            93:        int operator >= (const Path& t) const { return s >= t.s; }
        !            94:        int operator == (const Path& t) const { return s == t.s; }
        !            95:        int operator != (const Path& t) const { return s != t.s; }
        !            96:        int operator < (char* t) const { return s < t; }
        !            97:        int operator > (char* t) const { return s > t; }
        !            98:        int operator <= (char* t) const { return s <= t; }
        !            99:        int operator >= (char* t) const { return s >= t; }
        !           100:        int operator == (char* t) const { return s == t; }
        !           101:        int operator != (char* t) const { return s != t; }
        !           102:        friend int operator < (char* p, const Path& q) { return p < q.s; }
        !           103:        friend int operator > (char* p, const Path& q) { return p > q.s; }
        !           104:        friend int operator <= (char* p, const Path& q) { return p <= q.s; }
        !           105:        friend int operator >= (char* p, const Path& q) { return p >= q.s; }
        !           106:        friend int operator == (char* p, const Path& q) { return p == q.s; }
        !           107:        friend int operator != (char* p, const Path& q) { return p != q.s; }
        !           108: };
        !           109: 
        !           110: Path homedir();
        !           111: 
        !           112: listdeclare(Path)
        !           113: 
        !           114: // lock.c
        !           115: 
        !           116: void lock (Path&);
        !           117: void unlock (Path&);
        !           118: 
        !           119: // dir.c
        !           120: 
        !           121: int isdir (Path&);
        !           122: Path_list dircontents (Path&);
        !           123: 
        !           124: // domach.c
        !           125: 
        !           126: String domach (String, Path, String_list&);
        !           127: 
        !           128: // checksum.c
        !           129: 
        !           130: static const cksize = 37;
        !           131: 
        !           132: class checksum {
        !           133:        char buf[cksize];
        !           134:        char *bufptr;
        !           135:        char *bufend;
        !           136: public:
        !           137:        checksum();
        !           138:        void combine (char*, int);
        !           139:        int operator== (checksum&);
        !           140:        int operator!= (checksum& c) { return !(*this == c); }
        !           141:        friend int read (int fd, checksum& c)
        !           142:                { return ::read (fd, c.buf, cksize); }
        !           143:        friend int write (int fd, checksum& c)
        !           144:                { return ::write (fd, c.buf, cksize); }
        !           145: };
        !           146: 
        !           147: // param.c
        !           148: 
        !           149: extern char* spooldir;
        !           150: extern char* etcdir;
        !           151: extern char* inspkg;
        !           152: extern char* tmpdir;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.