kervinck / gigatron-rom

System, apps and tooling for the Gigatron TTL microcomputer
BSD 2-Clause "Simplified" License
229 stars 81 forks source link

lcc: complete vsnprintf #69

Open kervinck opened 5 years ago

kervinck commented 5 years ago
  1. Handle EOF error from putc
  2. Handle size, flags, width and precision
  3. Implement %o %x %X %p
  4. Cross-check with C89 standard instead of K&R2
  5. Make charout() much more efficient with a different strategy to detect streams. Mark stream functions by passing a negative (int)size to vsnprintf. Then the stream/string decision can be made once at the top of vsnprintf. Streams then continue writing as a string in their buffer. (If the buffer is full, flush it and continue.)
kervinck commented 5 years ago

On 5, we can use a more subtle mechanism, because UINT_MAX is not an unreasonable value for 'size' in real code.. A new idea is to flag streams as (str+size == 0) or (str+size == 1).

kervinck commented 5 years ago

Step forward: https://github.com/kervinck/gigatron-rom/commit/0fea8bbab692db8b5d1ba6265956523dd909c9e9

lb3361 commented 1 year ago

Suggesting to close this issue since glcc has this already.