Run `indent' on the whole tree

Can't indent the .y files yet, they need special treatment.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
This commit is contained in:
Vegard Nossum
2009-06-11 07:59:46 +02:00
parent 660f5daac3
commit b6c749ffbd
47 changed files with 5105 additions and 5495 deletions

View File

@@ -7,216 +7,192 @@
#include "main.h"
#include "assign.h"
char tzOutname[_MAX_PATH];
BBOOL oOutput=0;
char tzOutname[_MAX_PATH];
BBOOL oOutput = 0;
void writehome( FILE *f )
void writehome(FILE * f)
{
struct sSection *pSect;
UBYTE *mem;
UBYTE *mem;
if( mem=(UBYTE *)malloc(MaxAvail[BANK_HOME]) )
{
if( fillchar!=-1 )
{
memset( mem, fillchar, MaxAvail[BANK_HOME] );
if (mem = (UBYTE *) malloc(MaxAvail[BANK_HOME])) {
if (fillchar != -1) {
memset(mem, fillchar, MaxAvail[BANK_HOME]);
}
MapfileInitBank( 0 );
MapfileInitBank(0);
pSect=pSections;
while( pSect )
{
if( pSect->Type==SECT_HOME )
{
memcpy( mem+pSect->nOrg, pSect->pData, pSect->nByteSize );
MapfileWriteSection( pSect );
pSect = pSections;
while (pSect) {
if (pSect->Type == SECT_HOME) {
memcpy(mem + pSect->nOrg, pSect->pData,
pSect->nByteSize);
MapfileWriteSection(pSect);
}
pSect=pSect->pNext;
pSect = pSect->pNext;
}
MapfileCloseBank( area_Avail(0) );
MapfileCloseBank(area_Avail(0));
fwrite( mem, 1, MaxAvail[BANK_HOME], f );
free( mem );
fwrite(mem, 1, MaxAvail[BANK_HOME], f);
free(mem);
}
}
void writebank( FILE *f, SLONG bank )
void writebank(FILE * f, SLONG bank)
{
struct sSection *pSect;
UBYTE *mem;
UBYTE *mem;
if( mem=(UBYTE *)malloc(MaxAvail[bank]) )
{
if( fillchar!=-1 )
{
memset( mem, fillchar, MaxAvail[bank] );
if (mem = (UBYTE *) malloc(MaxAvail[bank])) {
if (fillchar != -1) {
memset(mem, fillchar, MaxAvail[bank]);
}
MapfileInitBank( bank );
MapfileInitBank(bank);
pSect=pSections;
while( pSect )
{
if( pSect->Type==SECT_CODE && pSect->nBank==bank )
{
memcpy( mem+pSect->nOrg-0x4000, pSect->pData, pSect->nByteSize );
MapfileWriteSection( pSect );
pSect = pSections;
while (pSect) {
if (pSect->Type == SECT_CODE && pSect->nBank == bank) {
memcpy(mem + pSect->nOrg - 0x4000, pSect->pData,
pSect->nByteSize);
MapfileWriteSection(pSect);
}
pSect=pSect->pNext;
pSect = pSect->pNext;
}
MapfileCloseBank( area_Avail(bank) );
MapfileCloseBank(area_Avail(bank));
fwrite( mem, 1, MaxAvail[bank], f );
free( mem );
fwrite(mem, 1, MaxAvail[bank], f);
free(mem);
}
}
void out_Setname( char *tzOutputfile )
void out_Setname(char *tzOutputfile)
{
strcpy( tzOutname, tzOutputfile );
oOutput=1;
strcpy(tzOutname, tzOutputfile);
oOutput = 1;
}
void GBROM_Output( void )
void GBROM_Output(void)
{
SLONG i;
FILE *f;
if( f=fopen(tzOutname,"wb") )
{
writehome( f );
for( i=1; i<=MaxBankUsed; i+=1 )
writebank( f, i );
if (f = fopen(tzOutname, "wb")) {
writehome(f);
for (i = 1; i <= MaxBankUsed; i += 1)
writebank(f, i);
fclose( f );
fclose(f);
}
for( i=256; i<MAXBANKS; i+=1 )
{
struct sSection *pSect;
MapfileInitBank( i );
pSect=pSections;
while( pSect )
{
if( pSect->nBank==i )
{
MapfileWriteSection( pSect );
for (i = 256; i < MAXBANKS; i += 1) {
struct sSection *pSect;
MapfileInitBank(i);
pSect = pSections;
while (pSect) {
if (pSect->nBank == i) {
MapfileWriteSection(pSect);
}
pSect=pSect->pNext;
pSect = pSect->pNext;
}
MapfileCloseBank( area_Avail(i) );
MapfileCloseBank(area_Avail(i));
}
}
void PSION2_Output( void )
void PSION2_Output(void)
{
FILE *f;
if( f=fopen(tzOutname,"wb") )
{
if (f = fopen(tzOutname, "wb")) {
struct sSection *pSect;
UBYTE *mem;
ULONG size=MaxAvail[0]-area_Avail(0);
ULONG relocpatches;
UBYTE *mem;
ULONG size = MaxAvail[0] - area_Avail(0);
ULONG relocpatches;
fputc( size>>24, f );
fputc( size>>16, f );
fputc( size>>8, f );
fputc( size, f );
fputc(size >> 24, f);
fputc(size >> 16, f);
fputc(size >> 8, f);
fputc(size, f);
if( mem=(UBYTE *)malloc(MaxAvail[0]-area_Avail(0)) )
{
MapfileInitBank( 0 );
if (mem = (UBYTE *) malloc(MaxAvail[0] - area_Avail(0))) {
MapfileInitBank(0);
pSect=pSections;
while( pSect )
{
if( pSect->Type==SECT_CODE )
{
memcpy( mem+pSect->nOrg, pSect->pData, pSect->nByteSize );
MapfileWriteSection( pSect );
pSect = pSections;
while (pSect) {
if (pSect->Type == SECT_CODE) {
memcpy(mem + pSect->nOrg, pSect->pData,
pSect->nByteSize);
MapfileWriteSection(pSect);
} else {
memset(mem + pSect->nOrg, 0,
pSect->nByteSize);
}
else
{
memset( mem+pSect->nOrg, 0, pSect->nByteSize );
}
pSect=pSect->pNext;
pSect = pSect->pNext;
}
MapfileCloseBank( area_Avail(0) );
MapfileCloseBank(area_Avail(0));
fwrite( mem, 1, MaxAvail[0]-area_Avail(0), f );
free( mem );
fwrite(mem, 1, MaxAvail[0] - area_Avail(0), f);
free(mem);
}
relocpatches=0;
pSect=pSections;
while( pSect )
{
struct sPatch *pPatch;
relocpatches = 0;
pSect = pSections;
while (pSect) {
struct sPatch *pPatch;
pPatch=pSect->pPatches;
pPatch = pSect->pPatches;
while( pPatch )
{
if( pPatch->oRelocPatch )
{
relocpatches+=1;
while (pPatch) {
if (pPatch->oRelocPatch) {
relocpatches += 1;
}
pPatch=pPatch->pNext;
pPatch = pPatch->pNext;
}
pSect=pSect->pNext;
pSect = pSect->pNext;
}
fputc( relocpatches>>24, f );
fputc( relocpatches>>16, f );
fputc( relocpatches>>8, f );
fputc( relocpatches, f );
fputc(relocpatches >> 24, f);
fputc(relocpatches >> 16, f);
fputc(relocpatches >> 8, f);
fputc(relocpatches, f);
pSect=pSections;
while( pSect )
{
struct sPatch *pPatch;
pSect = pSections;
while (pSect) {
struct sPatch *pPatch;
pPatch=pSect->pPatches;
pPatch = pSect->pPatches;
while( pPatch )
{
if( pPatch->oRelocPatch )
{
ULONG address;
while (pPatch) {
if (pPatch->oRelocPatch) {
ULONG address;
address=pPatch->nOffset+pSect->nOrg;
fputc( address>>24, f );
fputc( address>>16, f );
fputc( address>>8, f );
fputc( address, f );
address = pPatch->nOffset + pSect->nOrg;
fputc(address >> 24, f);
fputc(address >> 16, f);
fputc(address >> 8, f);
fputc(address, f);
}
pPatch=pPatch->pNext;
pPatch = pPatch->pNext;
}
pSect=pSect->pNext;
pSect = pSect->pNext;
}
fclose( f );
fclose(f);
}
}
void Output( void )
void Output(void)
{
if( oOutput )
{
switch( outputtype )
{
case OUTPUT_GBROM:
GBROM_Output();
break;
case OUTPUT_PSION2:
PSION2_Output();
break;
if (oOutput) {
switch (outputtype) {
case OUTPUT_GBROM:
GBROM_Output();
break;
case OUTPUT_PSION2:
PSION2_Output();
break;
}
}
}
}