#include #include // man 2 stat #include #include #include #include #include #include #define C const typedef double _Complex c; typedef long double _Complex cx; typedef unsigned char uchar; static void pc(c a){printf("%12.2f + %12.2fi ", __real__ a, __imag__ a);} static double sq(double x){return x*x;} static void fft(c a[], C int n){ {int j=0, i; for(i=0; i>(j<<3))&255)) return 0; return 1;} static void ex(int C d){exit(-3);} static void bitch(char C * C s){ex(fprintf(stderr, "%s: Bye.\n", s));} int main(){ if(!stdin) bitch("No input file!"); {struct stat Ss; if(fstat(fileno(stdin), &Ss)) bitch("fstat failed"); if (!Ss.st_size) bitch("Empty file."); {void C * C pp = mmap(0, Ss.st_size, PROT_READ, MAP_SHARED, fileno(stdin), 0); if(0) printf("file starts: %08x %08x\n", *(int *)pp, *(int *)(pp+4)); if(!cn("FORM", pp)) bitch("Doesn't begin 'FORM'."); printf("Size from stat: 0x%x, size from FormAIFCChunk: 0x%08x\n", (int)Ss.st_size, gi(pp+4, 4)); if(!cn("AIFC", pp+8)) bitch("Expect AIFC chunk; not there."); printf("Size from AFIC chunk: 0x%x\n", gi(pp+12, 4)); {void C * q = pp+12; void C * C pend = pp + gi(pp+4, 4); void C * fverp=0, * commp=0, * ssndp=0; while(q 1.e13) {pc(s[j]); printf("%0.6f %8.0f\n", (float)j/(1<