Mercurial > hg-old > index.cgi
changeset 305:10cc87f4b16c
Added basic raw output module
author | lost |
---|---|
date | Thu, 22 Jan 2009 02:14:52 +0000 |
parents | 9c6462b3a288 |
children | be1abc4ac114 |
files | src/output.c |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/output.c Thu Jan 22 02:05:30 2009 +0000 +++ b/src/output.c Thu Jan 22 02:14:52 2009 +0000 @@ -100,4 +100,23 @@ void do_output_raw(FILE *of) { + int nskips = 0; // used to output blanks for BSS inline + int sn; + + for (sn = 0; sn < nsects; sn++) + { + if (sectlist[sn].ptr -> flags & SECTION_BSS) + { + // no output for a BSS section + nskips += sectlist[sn].ptr -> codesize; + continue; + } + while (nskips > 0) + { + // the "" is not an error - it turns into a single NUL byte! + writebytes("", 1, 1, of); + nskips--; + } + writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of); + } }