ref: 27a3e413d3339a80fc4721257aaface77ad7f6e0
dir: /llt/notes/
my c library (jlibc) ------------ * bytevector utilities: memswap, memreverse, swap_el, etc. * hashing, random#s: int32hash, int64hash, int64to32hash, lookup3, ptrhash * utf8 * bitvector - iostream, socket, asynch io - cross-platform pathnames, cwd, exename, date/time, etc. * floating point number utils: comparison, print_real, print_cplx - strtab (with prefix searching) (- pool allocator with hooks for gc (sweep function)) (- list (dequeue)) (- sort: msort list, qsort numbers) not too important since stdlib has qsort - use non-allocating APIs. this means the interface never allocates or frees memory for you. you have to manage space for objects yourself. - separate math library. includes numal, cephes, my complex number routines, more special functions stream redesign: memstream, single-descriptor-backed, pipe (read/write on separate descriptors) do our own buffering, so we can implement getline without seek/skip all provided functions must be in terms of read,write,poll,flush only seek/skip will be available, but only works on files and strings change semantics of bit i/o so it doesn't require skip(-1) compare our implementation to somebody else's fread,fwrite,etc. cool trick for faking string streams with stdio: char buf[256]; v = list2(number(6), number(4)); FILE *f = fopen("/dev/null", "a"); setbuffer(f, buf, sizeof(buf)); print(f, v, 0); printf("got '%s'\n", buf);