kervinck / gigatron-rom

System, apps and tooling for the Gigatron TTL microcomputer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lcc: complete vsnprintf

kervinck opened this issue · comments

  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.)

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).

Step forward: 0fea8bb

Suggesting to close this issue since glcc has this already.