From 10a311ef6cda376be60b70bbd64171e13ba0f2ee Mon Sep 17 00:00:00 2001 From: ijackson Date: Wed, 21 Jan 2004 10:58:45 +0000 Subject: [PATCH] image used area stuff found --- bcp5-registry.pl | 4 ++ image.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 image.c diff --git a/bcp5-registry.pl b/bcp5-registry.pl index 3e9b2f6..3bfaa0d 100755 --- a/bcp5-registry.pl +++ b/bcp5-registry.pl @@ -185,6 +185,10 @@ if ($invokestyle eq 'maintain') { close STDOUT or die $!; exit 0; +} elsif (length $in{'imageareai'}) { + + + } elsif (length $in{'register'}) { lock_database(); diff --git a/image.c b/image.c new file mode 100644 index 0000000..34420a0 --- /dev/null +++ b/image.c @@ -0,0 +1,119 @@ +/**/ + +#define MAXVIEWSIZE 16 + +typedef unsigned char ae; +typedef unsigned long ad; + +static ae mainary[1<0; rgo-=2) { + int tn= (v >> rgo) & 3; + if (!tn) next; + n += tn; + if (n>2) { rgb_io[0]=rgb_io[1]=rgb_io[2]=255; *cpriority_io=500; } + rgof= rgo; + } + + assert(rgof>=0); + if (n==1) { + memset(rgb_io[0],0 + +int main(int argc, const char *argv) { + const char *ep; + ae *aep; + ad i; + + if (!argv[1]) fail("no space"); + space= strtoul(argv[1],ep,16); + if (!*ep++) fail("no space len"); + spacelen= atoi(ep); + + if (space>0xffffffffUL || spacelen<8 || spacelen>30) fail("bad space"); + spacesize= 32-spacelen; + viewsize= spacesize; if (viewsize>MAXVIEWSIZE) viewsize= MAXVIEWSIZE; + aggregate= spacesize-viewsize; + + allspace= 0; + + file= fopen(LISTFILE, "r"); if (!file) fail(strerror(errno)); + for (;;) { + if (!fgets(lbuf,sizeof(lbuf)-1,file)) readfail(); + if (buf[0]=='\2' && buf[1]=='\0') break; + dp= strchr(buf,'\1'); if (!dp) fail("format delim 1"); + dp++; here= strtoul(dp,&dp,16); if (!*dp) fail("format strtoul"); + if (*dp++ != '\1') fail("format delim 2"); + herelen= atoi(dp); + if (!strchr(buf,'\n')) { + while ((c=getc(file)) != EOF && c != '\n'); + if (c==EOF) readfail(); + } + if (here>0xffffffffUL || herelen<1 || herelen>32) fail("bad here"); + heresize= 32-herelen; + + if (heresize >= spacesize) { + if ((here^space) & (~0UL << spacesize)) continue; + allspace++; + continue; + } + + if ((here^space) & (~0UL << heresize)) continue; + + for (h=here; h>aggregate]; + if (!*paep) { *paep= calloc(1<>1, viewsize>>1); + + for (i=0; i<(1<>1; bn++) { + h0 |= h&1; h >>= 1; + h1 |= h&1; h >>= 1; + } + h= h1<<((viewsize+1)>>1) | h0; + + if (aggregate) { + ad g; + + rgb[0]=rgb[1]=rgb[2]=0; cpriority=0; + for (g=0; g<(1<