Have you seen these itty-bitty FPGA-like devices http://www.silego.com/index.php?page=greenpak ?
Do you know of anything similarly low-pin count with some "internal structure"? Your normal GALs and such seem to be very "macrocell per pin" oriented, and the CPLDs I've seen where you start to get the ability to have some "buried" functionality (counters, registers, etc) seem to start at around 44pins. I think one of the old PAL vendors (lattice?) used to sell (a long time ago) a "state machine" PLD with an extra 8bits worth of register that wasn't tied to pins, which is sort-of the kind of thing I'm looking for, but I haven't seen anything like that recently. (I'm not necessarily interested in analog functions...)