__FUNCTION__ removal for GCC3.x brain damage workaround
This allows gcc 3.2 at least to be used
This commit is contained in:
parent
9b1ab17c74
commit
90bd1db22e
11 changed files with 80 additions and 38 deletions
|
@ -1096,14 +1096,14 @@ local void AiAssignWorker(void)
|
|||
-- GOAL
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
IfDebug(
|
||||
/**
|
||||
** Show Goal
|
||||
*/
|
||||
local void AiShowGoal(const char *function, const AiGoal * goal)
|
||||
local void AiShowGoal(const AiGoal * goal)
|
||||
{
|
||||
IfDebug(
|
||||
|
||||
printf("\t%s:%d ", function, AiPlayer - Ais);
|
||||
fprintf(stdout, "%d ", AiPlayer - Ais);
|
||||
switch (goal->Action) {
|
||||
case AiCmdBuild: /// unit must be built
|
||||
printf("build %d*%s\n", goal->Number,
|
||||
|
@ -1116,8 +1116,9 @@ local void AiShowGoal(const char *function, const AiGoal * goal)
|
|||
case AiCmdArmy: /// attack the opponent
|
||||
printf("army %d*%d\n", goal->Number, goal->Unit);
|
||||
break;
|
||||
} );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
** Insert a new goal into the Ai player goal list.
|
||||
|
@ -1143,7 +1144,10 @@ local void AiNewGoal(int action, int number, int type)
|
|||
goal->Unit = type;
|
||||
AiPlayer->GoalHead = goal;
|
||||
|
||||
AiShowGoal(__FUNCTION__, goal);
|
||||
IfDebug(
|
||||
PrintFunction();
|
||||
AiShowGoal(goal);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1151,7 +1155,10 @@ local void AiNewGoal(int action, int number, int type)
|
|||
*/
|
||||
local void AiDelGoal(AiGoal * goal)
|
||||
{
|
||||
AiShowGoal(__FUNCTION__, goal);
|
||||
IfDebug(
|
||||
PrintFunction();
|
||||
AiShowGoal(goal);
|
||||
);
|
||||
goal->Next->Prev = goal->Prev;
|
||||
goal->Prev->Next = goal->Next;
|
||||
free(goal);
|
||||
|
|
|
@ -92,7 +92,11 @@
|
|||
|
||||
#if __GNUC__>=3
|
||||
|
||||
#if !defined(__I_KNOW_THAT_GNUC_3_IS_UNSUPPORTED__)
|
||||
#if __GNUC__==3 && __GNUC_MINOR__>=2 || __GNUC__>3
|
||||
#define __GCC32__MAYBE_OK__ 1
|
||||
#endif
|
||||
|
||||
#if !defined(__GCC32__MAYBE_OK__) && !defined(__I_KNOW_THAT_GNUC_3_IS_UNSUPPORTED__)
|
||||
#warning "GCC 3.XX is not supported, downgrade to GCC 2.95"
|
||||
#endif
|
||||
|
||||
|
@ -148,10 +152,14 @@
|
|||
|
||||
#endif // } m$
|
||||
|
||||
#if defined(__GCC32__MAYBE_OK__)
|
||||
#define PrintFunction() do { fprintf(stdout,"%s: ", __func__); } while(0)
|
||||
#else
|
||||
#ifndef PrintFunction
|
||||
/// Print function in debug macros
|
||||
#define PrintFunction() do { fprintf(stdout,__FUNCTION__": "); } while(0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
== Includes
|
||||
|
|
|
@ -248,7 +248,8 @@ local SCM CclFreeCraftMap(SCM list)
|
|||
local SCM CclRevealMap(void)
|
||||
{
|
||||
if( !CclInConfigFile ) {
|
||||
fprintf(stderr,__FUNCTION__": only in config file supported\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Only supported within config file\n");
|
||||
}
|
||||
FlagRevealMap=1;
|
||||
|
||||
|
@ -327,7 +328,8 @@ local SCM CclSetFogOfWarContrast(SCM contrast)
|
|||
|
||||
i=gh_scm2int(contrast);
|
||||
if( i<0 || i>400 ) {
|
||||
fprintf(stderr,__FUNCTION__": contrast should be 0-400\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Contrast should be 0-400\n");
|
||||
i=100;
|
||||
}
|
||||
o=FogOfWarContrast;
|
||||
|
@ -350,7 +352,8 @@ local SCM CclSetFogOfWarBrightness(SCM brightness)
|
|||
|
||||
i=gh_scm2int(brightness);
|
||||
if( i<-100 || i>100 ) {
|
||||
fprintf(stderr,__FUNCTION__": brightness should be -100-100\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Brightness should be -100-100\n");
|
||||
i=0;
|
||||
}
|
||||
o=FogOfWarBrightness;
|
||||
|
@ -373,7 +376,8 @@ local SCM CclSetFogOfWarSaturation(SCM saturation)
|
|||
|
||||
i=gh_scm2int(saturation);
|
||||
if( i<-100 || i>200 ) {
|
||||
fprintf(stderr,__FUNCTION__": saturation should be -100-200\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Saturation should be -100-200\n");
|
||||
i=0;
|
||||
}
|
||||
o=FogOfWarSaturation;
|
||||
|
@ -400,7 +404,8 @@ local SCM CclSetForestRegeneration(SCM speed)
|
|||
|
||||
i=gh_scm2int(speed);
|
||||
if( i<0 || i>255 ) {
|
||||
fprintf(stderr,__FUNCTION__": regneration speed should be 0-255\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Regneration speed should be 0-255\n");
|
||||
i=0;
|
||||
}
|
||||
o=ForestRegeneration;
|
||||
|
@ -423,7 +428,8 @@ local SCM CclSetGoldmineDepleted(SCM rate)
|
|||
|
||||
i=gh_scm2int(rate);
|
||||
if( i<0 || i>100 ) {
|
||||
fprintf(stderr,__FUNCTION__": deplated rate should be 0-100\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Deplated rate should be 0-100\n");
|
||||
i=0;
|
||||
}
|
||||
o=OptionUseDepletedMines;
|
||||
|
@ -446,11 +452,13 @@ local SCM CclSetBurnBuildings(SCM percent,SCM rate)
|
|||
p=gh_scm2int(percent);
|
||||
r=gh_scm2int(rate);
|
||||
if( p<0 || p>100 ) {
|
||||
fprintf(stderr,__FUNCTION__": burn percent should be 0-100\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Burn percent should be 0-100\n");
|
||||
p=0;
|
||||
}
|
||||
if( r<=0 ) {
|
||||
fprintf(stderr,__FUNCTION__": burn rate should be greater than 0\n");
|
||||
PrintFunction();
|
||||
fprintf(stderr,"Burn rate should be greater than 0\n");
|
||||
p=0;
|
||||
}
|
||||
BurnBuildingPercent=p;
|
||||
|
|
|
@ -593,7 +593,8 @@ global int NetRecvUDP(int sockfd,void* buf,int len)
|
|||
|
||||
n=sizeof(struct sockaddr_in);
|
||||
if( (l=recvfrom(sockfd,buf,len,0,(struct sockaddr*)&sock_addr,&n))<0 ) {
|
||||
fprintf(stderr,__FUNCTION__": Could not read from UDP socket\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Could not read from UDP socket\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ local SCM CclAStarSetFixedUCC(SCM cost)
|
|||
|
||||
i=gh_scm2int(cost);
|
||||
if( i<=0) {
|
||||
fprintf(stderr,__FUNCTION__": Fixed unit crossing cost must be strictly positive\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Fixed unit crossing cost must be strictly positive\n");
|
||||
i=TheMap.Width*TheMap.Height;
|
||||
}
|
||||
AStarFixedUnitCrossingCost=i;
|
||||
|
@ -104,7 +105,8 @@ local SCM CclAStarSetMovingUCC(SCM cost)
|
|||
|
||||
i=gh_scm2int(cost);
|
||||
if( i<=0) {
|
||||
fprintf(stderr,__FUNCTION__": Moving unit crossing cost must be strictly positive\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Moving unit crossing cost must be strictly positive\n");
|
||||
i=1;
|
||||
}
|
||||
AStarMovingUnitCrossingCost=i;
|
||||
|
|
|
@ -30,12 +30,14 @@
|
|||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "freecraft.h"
|
||||
|
||||
#if defined(WITH_SOUND) && !defined(USE_SDLA) // {
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "sound_server.h"
|
||||
|
||||
|
@ -79,21 +81,24 @@ global int InitOssSound(const char* dev,int freq,int size,int wait)
|
|||
}
|
||||
dummy=size;
|
||||
if( ioctl(SoundFildes,SNDCTL_DSP_SAMPLESIZE,&dummy)==-1 ) {
|
||||
perror(__FUNCTION__ " ioctl(SNDCTL_DSP_SAMPLESIZE)");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"%s - ioctl(SNDCTL_DSP_SAMPLESIZE)", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
}
|
||||
dummy=1;
|
||||
if( ioctl(SoundFildes,SNDCTL_DSP_STEREO,&dummy)==-1 ) {
|
||||
perror(__FUNCTION__ " ioctl(SNDCTL_DSP_STEREO)");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"%s - ioctl(SNDCTL_DSP_STEREO)", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
}
|
||||
dummy=freq;
|
||||
if( ioctl(SoundFildes,SNDCTL_DSP_SPEED,&dummy)==-1 ) {
|
||||
perror(__FUNCTION__ " ioctl(SNDCTL_DSP_SPEED)");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"%s - ioctl(SNDCTL_DSP_SPEED)", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
|
@ -125,7 +130,8 @@ global int InitOssSound(const char* dev,int freq,int size,int wait)
|
|||
((dummy>>16)*(1<<(dummy&0xFFFF))*1000)/(freq*size/8));
|
||||
|
||||
if( ioctl(SoundFildes,SNDCTL_DSP_SETFRAGMENT,&dummy)==-1 ) {
|
||||
perror(__FUNCTION__);
|
||||
PrintFunction();
|
||||
fprintf(stdout,"%s - ioctl(SNDCTL_DSP_SETFRAGMENT)", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
|
@ -134,7 +140,8 @@ global int InitOssSound(const char* dev,int freq,int size,int wait)
|
|||
#if 0
|
||||
dummy=4;
|
||||
if( ioctl(SoundFildes,SNDCTL_DSP_SUBDIVIDE,&dummy)==-1 ) {
|
||||
perror(__FUNCTION__ " ioctl(SNDCTL_DSP_SUBDIVIDE)");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"%s - ioctl(SNDCTL_DSP_SUBDIVIDE)", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return;
|
||||
|
@ -143,7 +150,8 @@ global int InitOssSound(const char* dev,int freq,int size,int wait)
|
|||
|
||||
#ifdef DEBUG
|
||||
if( ioctl(SoundFildes,SNDCTL_DSP_GETBLKSIZE,&dummy)==-1 ) {
|
||||
perror(__FUNCTION__ " ioctl(SNDCTL_DSP_GETBLKSIZE)");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"%s - ioctl(SNDCTL_DSP_GETBLKSIZE)", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
|
|
|
@ -291,7 +291,8 @@ local SCM CclDefineGameSounds(SCM list)
|
|||
name=gh_car(list);
|
||||
list=gh_cdr(list);
|
||||
if( !gh_symbol_p(name) ) {
|
||||
fprintf(stderr,__FUNCTION__": symbol expected\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Symbol expected\n");
|
||||
return list;
|
||||
}
|
||||
// prepare for next iteration
|
||||
|
|
|
@ -77,9 +77,10 @@ global void DisplaySoundHashTable(void)
|
|||
{
|
||||
struct hash_st st;
|
||||
|
||||
fprintf(stderr,"Sound HashTable Begin\n");
|
||||
fprintf(stderr,__FUNCTION__": FIXME: not written\n");
|
||||
fprintf(stderr,"Sound HashTable End\n");
|
||||
fprintf(stdout,"Sound HashTable Begin\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"FIXME: not written\n");
|
||||
fprintf(stdout,"Sound HashTable End\n");
|
||||
|
||||
hash_stat(SoundIdHash, &st);
|
||||
printf("nelem : %d\n", st.nelem);
|
||||
|
|
|
@ -1226,14 +1226,17 @@ global int InitSoundServer(void)
|
|||
//prepare for the sound thread
|
||||
if( sem_init(&SoundThreadChannelSemaphore,0,0) ) {
|
||||
//FIXME: better error handling
|
||||
perror(__FUNCTION__);
|
||||
PrintFunction();
|
||||
// FIXME: ARI: strerror_r() is better here, but not compatible
|
||||
fprintf(stdout, "%s\n", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
}
|
||||
if( pthread_create(&SoundThread,NULL,(void *)&WriteSoundThreaded,NULL) ) {
|
||||
//FIXME: better error handling
|
||||
perror(__FUNCTION__);
|
||||
PrintFunction();
|
||||
fprintf(stdout, "%s\n", strerror(errno));
|
||||
close(SoundFildes);
|
||||
SoundFildes=-1;
|
||||
return 1;
|
||||
|
|
|
@ -133,7 +133,8 @@ local SCM CclSetContrast(SCM contrast)
|
|||
old=gh_int2scm(TheUI.Contrast);
|
||||
i=gh_scm2int(contrast);
|
||||
if( i<0 || i>400 ) {
|
||||
fprintf(stderr,__FUNCTION__": contrast should be 0-400\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Contrast should be 0-400\n");
|
||||
i=100;
|
||||
}
|
||||
TheUI.Contrast=i;
|
||||
|
@ -157,7 +158,8 @@ local SCM CclSetBrightness(SCM brightness)
|
|||
old=gh_int2scm(TheUI.Brightness);
|
||||
i=gh_scm2int(brightness);
|
||||
if( i<-100 || i>100 ) {
|
||||
fprintf(stderr,__FUNCTION__": brightness should be -100-100\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Brightness should be -100-100\n");
|
||||
i=0;
|
||||
}
|
||||
TheUI.Brightness=i;
|
||||
|
@ -182,7 +184,8 @@ local SCM CclSetSaturation(SCM saturation)
|
|||
|
||||
i=gh_scm2int(saturation);
|
||||
if( i<-100 || i>200 ) {
|
||||
fprintf(stderr,__FUNCTION__": saturation should be -100-200\n");
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Saturation should be -100-200\n");
|
||||
i=0;
|
||||
}
|
||||
TheUI.Saturation=i;
|
||||
|
|
|
@ -284,9 +284,9 @@ global void ParsePudUDTA(const char* udta,int length __attribute__((unused)))
|
|||
// FIXME: not the fastest, remove UnitTypeByWcNum from loops!
|
||||
IfDebug(
|
||||
if( length!=5694 && length!=5948 ) {
|
||||
DebugLevel0("\n"__FUNCTION__": ***\n"__FUNCTION__": %d\n"
|
||||
_C_ length);
|
||||
DebugLevel0Fn("***\n\n");
|
||||
DebugLevel0("\n***\n");
|
||||
DebugLevel0Fn("%d\n" _C_ length);
|
||||
DebugLevel0("***\n\n");
|
||||
}
|
||||
)
|
||||
start=udta;
|
||||
|
@ -1256,8 +1256,8 @@ global void LoadUnitTypes(void)
|
|||
|
||||
unittype=UnitTypeByIdent(type->SameSprite);
|
||||
if( !unittype ) {
|
||||
fprintf(stderr,__FUNCTION__": unit-type %s not found\n"
|
||||
,type->SameSprite);
|
||||
PrintFunction();
|
||||
fprintf(stdout,"Unit-type %s not found\n" ,type->SameSprite);
|
||||
ExitFatal(-1);
|
||||
}
|
||||
type->Sprite=unittype->Sprite;
|
||||
|
|
Loading…
Add table
Reference in a new issue