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,119 +7,101 @@
#define HASHSIZE 73
struct ISymbol
{
char *pzName;
SLONG nValue;
SLONG nBank; // -1=const
struct ISymbol *pNext;
struct ISymbol {
char *pzName;
SLONG nValue;
SLONG nBank; // -1=const
struct ISymbol *pNext;
};
struct ISymbol *tHash[HASHSIZE];
SLONG calchash( char *s )
SLONG calchash(char *s)
{
SLONG r=0;
while( *s )
r+=*s++;
SLONG r = 0;
while (*s)
r += *s++;
return( r%HASHSIZE );
return (r % HASHSIZE);
}
void sym_Init( void )
void sym_Init(void)
{
SLONG i;
for( i=0; i<HASHSIZE; i+=1 )
tHash[i]=NULL;
SLONG i;
for (i = 0; i < HASHSIZE; i += 1)
tHash[i] = NULL;
}
SLONG sym_GetValue( char *tzName )
SLONG sym_GetValue(char *tzName)
{
if( strcmp(tzName,"@")==0 )
{
return( nPC );
}
else
{
if (strcmp(tzName, "@") == 0) {
return (nPC);
} else {
struct ISymbol **ppSym;
ppSym=&(tHash[calchash(tzName)]);
while( *ppSym )
{
if( strcmp(tzName,(*ppSym)->pzName) )
{
ppSym=&((*ppSym)->pNext);
}
else
{
return( (*ppSym)->nValue );
ppSym = &(tHash[calchash(tzName)]);
while (*ppSym) {
if (strcmp(tzName, (*ppSym)->pzName)) {
ppSym = &((*ppSym)->pNext);
} else {
return ((*ppSym)->nValue);
}
}
sprintf( temptext, "Unknown symbol '%s'", tzName );
fatalerror( temptext );
return( 0 );
sprintf(temptext, "Unknown symbol '%s'", tzName);
fatalerror(temptext);
return (0);
}
}
SLONG sym_GetBank( char *tzName )
SLONG sym_GetBank(char *tzName)
{
struct ISymbol **ppSym;
ppSym=&(tHash[calchash(tzName)]);
while( *ppSym )
{
if( strcmp(tzName,(*ppSym)->pzName) )
{
ppSym=&((*ppSym)->pNext);
}
else
{
return( (*ppSym)->nBank );
ppSym = &(tHash[calchash(tzName)]);
while (*ppSym) {
if (strcmp(tzName, (*ppSym)->pzName)) {
ppSym = &((*ppSym)->pNext);
} else {
return ((*ppSym)->nBank);
}
}
sprintf( temptext, "Unknown symbol '%s'" );
fatalerror( temptext );
return( 0 );
sprintf(temptext, "Unknown symbol '%s'");
fatalerror(temptext);
return (0);
}
void sym_CreateSymbol( char *tzName, SLONG nValue, SBYTE nBank )
void sym_CreateSymbol(char *tzName, SLONG nValue, SBYTE nBank)
{
if( strcmp(tzName,"@")==0 )
{
}
else
{
if (strcmp(tzName, "@") == 0) {
} else {
struct ISymbol **ppSym;
ppSym=&(tHash[calchash(tzName)]);
ppSym = &(tHash[calchash(tzName)]);
while( *ppSym )
{
if( strcmp(tzName,(*ppSym)->pzName) )
{
ppSym=&((*ppSym)->pNext);
}
else
{
if( nBank==-1 )
while (*ppSym) {
if (strcmp(tzName, (*ppSym)->pzName)) {
ppSym = &((*ppSym)->pNext);
} else {
if (nBank == -1)
return;
sprintf( temptext, "Symbol '%s' defined more than once\n", tzName );
fatalerror( temptext );
sprintf(temptext,
"Symbol '%s' defined more than once\n",
tzName);
fatalerror(temptext);
}
}
if( *ppSym=(struct ISymbol *)malloc(sizeof(struct ISymbol)) )
{
if( (*ppSym)->pzName=(char *)malloc(strlen(tzName)+1) )
{
strcpy( (*ppSym)->pzName, tzName );
(*ppSym)->nValue=nValue;
(*ppSym)->nBank=nBank;
(*ppSym)->pNext=NULL;
if (*ppSym = (struct ISymbol *)malloc(sizeof(struct ISymbol))) {
if ((*ppSym)->pzName =
(char *)malloc(strlen(tzName) + 1)) {
strcpy((*ppSym)->pzName, tzName);
(*ppSym)->nValue = nValue;
(*ppSym)->nBank = nBank;
(*ppSym)->pNext = NULL;
}
}
}
}
}