diff --git a/sources/setfile.c b/sources/setfile.c index 0975324c..61e32e22 100644 --- a/sources/setfile.c +++ b/sources/setfile.c @@ -92,6 +92,7 @@ SETUPPARAMETERS setupparameters[] = ,{(UBYTE *)"smallsize", NUMERICALVALUE, 0, (LONG)SMALLBUFFER} ,{(UBYTE *)"sortiosize", NUMERICALVALUE, 0, (LONG)SORTIOSIZE} ,{(UBYTE *)"sorttype", STRINGVALUE, 0, (LONG)lowfirst} + ,{(UBYTE *)"spectatorsize", NUMERICALVALUE, 0, (LONG)SPECTATORSIZE} ,{(UBYTE *)"subfilepatches", NUMERICALVALUE, 0, (LONG)SMAXFPATCHES} ,{(UBYTE *)"sublargepatches", NUMERICALVALUE, 0, (LONG)SMAXPATCHES} ,{(UBYTE *)"sublargesize", NUMERICALVALUE, 0, (LONG)SLARGEBUFFER} @@ -576,6 +577,8 @@ int AllocSetups() AM.SMaxFpatches = sp->value; sp = GetSetupPar((UBYTE *)"subsortiosize"); AM.SIOsize = sp->value; + sp = GetSetupPar((UBYTE *)"spectatorsize"); + AM.SpectatorSize = sp->value; /* The next code is just for the moment (26-jan-1997) because we have the new parts combined with the old. Once the old parts are gone @@ -825,10 +828,12 @@ SORTING *AllocSort(LONG LargeSize, LONG SmallSize, LONG SmallEsize, LONG TermsIn longerp += sizeof(WORD*) - (longerp%sizeof(WORD *)); longer++; longer += sizeof(WORD*) - (longer%sizeof(WORD *)); + if ( SmallSize < 16*AM.MaxTer ) SmallSize = 16*AM.MaxTer+16; TermsInSmall = (TermsInSmall+15) & (-16L); terms2insmall = 2*TermsInSmall; /* Used to be just + 100 rather than *2 */ if ( SmallEsize < (SmallSize*3)/2 ) SmallEsize = (SmallSize*3)/2; - if ( SmallEsize < 3*AM.MaxTer ) SmallEsize = 3*AM.MaxTer; + if ( LargeSize > 0 && LargeSize < 2*SmallSize ) LargeSize = 2*SmallSize; +/* if ( SmallEsize < 3*AM.MaxTer ) SmallEsize = 3*AM.MaxTer; */ SmallEsize = (SmallEsize+15) & (-16L); if ( LargeSize < 0 ) LargeSize = 0; sortsize = sizeof(SORTING); @@ -956,32 +961,33 @@ VOID AllocSortFileName(SORTING *sort) #[ AllocFileHandle : */ -FILEHANDLE *AllocFileHandle() +FILEHANDLE *AllocFileHandle(WORD par,char *name) { GETIDENTITY - LONG allocation; + LONG allocation, Ssize; FILEHANDLE *fh; int i = 0; char *s, *t; s = FG.fname2; i = 0; while ( *s ) { s++; i++; } - i += 16; -/* i += 11; */ + if ( par == 0 ) { i += 16; Ssize = AM.SIOsize; } + else { s = name; while ( *s ) { i++; s++; } i+= 2; Ssize = AM.SpectatorSize; } - allocation = sizeof(FILEHANDLE) + (AM.SIOsize+1)*sizeof(WORD) + i*sizeof(char); + allocation = sizeof(FILEHANDLE) + (Ssize+1)*sizeof(WORD) + i*sizeof(char); fh = (FILEHANDLE *)Malloc1(allocation,"FileHandle"); fh->PObuffer = (WORD *)(fh+1); - fh->POstop = fh->PObuffer+AM.SIOsize; - fh->POsize = AM.SIOsize * sizeof(WORD); + fh->POstop = fh->PObuffer+Ssize; + fh->POsize = Ssize * sizeof(WORD); fh->active = 0; fh->handle = -1; PUTZERO(fh->POposition); #ifdef WITHPTHREADS fh->pthreadslock = dummylock; #endif - if ( AM.S0 != 0 ) { + if ( par == 0 ) { /* sort file */ + if ( AM.S0 != 0 ) { fh->name = (char *)(fh->POstop + 1); s = FG.fname2; t = fh->name; while ( *s ) *t++ = *s++; @@ -993,8 +999,17 @@ FILEHANDLE *AllocFileHandle() sprintf(t-1,"%d",AN.filenum); #endif AN.filenum++; + } + else fh->name = 0; + } + else { /* Spectator file */ + fh->name = (char *)(fh->POstop + 1); + s = FG.fname; t = fh->name; + for ( i = 0; i < FG.fnamebase; i++ ) *t++ = *s++; + s = name; + while ( *s ) *t++ = *s++; + *t = 0; } - else fh->name = 0; fh->POfill = fh->POfull = fh->PObuffer; return(fh); }