All contributions in this site reflect the authors' opinions and they are not necessarily endorsed by, or reflect the beliefs of, anarchyinthetubes, as neither do most of the opinions in other sites.

cat-v (mirror)

Lib - Limbo Library

Libmodule
{
        PATH:   con     "$Lib";

        # Lock structure
        # Pid is valid when lock is held - other data is hidden
        #
        Lockprotected adt
        {
                pid:    int;
        };

        # Semaphore structure
        # Value is very volatile - other data is hidden
        #
        Semprotected adt
        {
                value:  int;
                limit:  int;
        };

        # An interned string and a hash [0, 2^31)
        #
        Nameprotected adt
        {
                name:   string;
                hash:   int;
        };

        byte2char:      fn(bufarray of bytenint): (intintint);
        char2byte:      fn(cintbufarray of bytenint): int;
        strtok:         fn(sdelimstringaarray of string): int;
        tokenize:       fn(sdelimstring): (intlist of string);
        utfbytes:       fn(bufarray of bytenint): int;
        quote:          fn(sstringdelimstring): string;
        quotel:         fn(llist of stringdelimstring): string;
        unquote:        fn(sstring): string;
        unquotel:       fn(sdelimstring): (intlist of string);

        intern:         fn(sstring): string;
        name:           fn(sstring): ref Name;

        newlock:        fn(): ref Lock;
        lock:           fn(lref Lock);
        rlock:          fn(lref Lock);
        canlock:        fn(lref Lock): int;
        canrlock:       fn(lref Lock): int;
        unlock:         fn(lref Lock);

        semnew:         fn(nint): ref Sem;
        semacquire:     fn(sref Sem);
        semcanacq:      fn(sref Sem): int;
        semrelease:     fn(sref Sem);

        ASET,
        ACLEAR,
        AMIN,
        AMAX:   con iota;

        alarm:          fn(cchan of intmsintflagint);

        memmapi:        fn(aarray of bytenint): array of int;
        memmapb:        fn(aarray of bytenint): array of big;
        memmapr:        fn(aarray of bytenint): array of real;
};
original page
cat.4l77.com