From 64c85dfc1d3b546dd4b5f84168e9256817f3a741 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 20 Feb 2014 02:46:41 +0100 Subject: clean up source directory --- src/postprocess/dumppointers2.c | 127 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 src/postprocess/dumppointers2.c (limited to 'src/postprocess/dumppointers2.c') diff --git a/src/postprocess/dumppointers2.c b/src/postprocess/dumppointers2.c new file mode 100644 index 0000000..80a4b61 --- /dev/null +++ b/src/postprocess/dumppointers2.c @@ -0,0 +1,127 @@ +#include +#include +#include + +#define BUFSIZE 0x1000000 +#define BUFLOW 0x400 +static int infile = -1; +static unsigned char nblock[ BUFSIZE + 16 ]; +static unsigned char*inblock = nblock + 16; +static unsigned long inblockoffs = 0; + +static unsigned long infilesize = 0; +static unsigned long infileoffs = 0; +static unsigned char to_lower[]; +static unsigned char run = 1; + +static void buffer_lowwatermark( void ) +{ + int i; + if( infilesize - infileoffs < BUFSIZE ) + return; + memmove( inblock, inblock + inblockoffs, BUFSIZE - inblockoffs ); + read( infile, inblock + (BUFSIZE - inblockoffs), inblockoffs); + for ( i = BUFSIZE - inblockoffs; i BUFSIZE - BUFLOW ) + buffer_lowwatermark(); + if( infilesize <= infileoffs + inblockoffs) + return 0; + if( !(mycount++ & 255) ) + printf( "%cSo far: %010.6f%% (%010lu / %010lu)", 13, 100.00 * (double)(infileoffs+inblockoffs) / (double)infilesize, infileoffs+inblockoffs, infilesize ); + // Fall through + case 1 : + use = (1< 1 ) ) + { + if( !fd[ b | (a*256) ][currrow] ) + nowfd = fd[ b | (a*256) ][currrow] = makefile( currrow, a, b); + else + nowfd = fd[ b | (a*256) ][currrow]; + + *(unsigned long*)(inblock+inblockoffs-4) = infileoffs + inblockoffs - 1 - inrow; + inblock[inblockoffs] = inrow++; + write( nowfd, inblock+inblockoffs-4, 16); + inblock[inblockoffs] = b; + break; + } + } + } + + return 0; +} -- cgit v1.2.3