From 88caf1dc713ae1d62f2a632f816e514e73a24232 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sat, 25 Apr 2009 16:25:03 +0000 Subject: [PATCH] Add compiler testing for always_inline attribute Add compiler testing for fastcall attribute Add the FASTCALL define to visual c Remove some overkill inline routines Make sure that all the inline routines in headers are static Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3355 --- acinclude.m4 | 13 ++++++- configure.in | 19 ++++++++++ include/callback.h | 8 ++-- include/cpu.h | 12 +++--- include/dos_inc.h | 20 +++++----- include/fpu.h | 16 ++++---- include/inout.h | 6 +-- include/mem.h | 70 +++++++++++++++++------------------ include/mixer.h | 4 +- include/paging.h | 52 +++++++++++++------------- include/pic.h | 8 ++-- include/regs.h | 8 ++-- include/support.h | 14 ++----- src/hardware/dbopl.cpp | 16 ++++---- src/hardware/dbopl.h | 4 +- src/hardware/mixer.cpp | 6 +-- src/ints/int10.h | 6 +-- src/ints/int10_char.cpp | 28 +++++++------- src/misc/support.cpp | 13 ++++++- src/platform/visualc/config.h | 6 +-- 20 files changed, 182 insertions(+), 147 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 2b5d94a1..cab7e791 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -323,7 +323,18 @@ AH_TOP([ */ ]) -AH_BOTTOM([#define INLINE inline]) +AH_BOTTOM([#if C_ATTRIBUTE_ALWAYS_INLINE +#define INLINE __attribute__((always_inline)) +#else +#define INLINE inline +#endif]) + +AH_BOTTOM([#if C_ATTRIBUTE_FASTCALL +#define DB_FASTCALL __attribute__((fastcall)) +#else +#define DB_FASTCALL +#endif]) + AH_BOTTOM([#if C_HAS_ATTRIBUTE #define GCC_ATTRIBUTE(x) __attribute__ ((x)) diff --git a/configure.in b/configure.in index 1d9f13a9..7ed482af 100644 --- a/configure.in +++ b/configure.in @@ -142,6 +142,25 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ typedef struct { } __attribute__((packed)) junk;]], [[ ]])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no)) + +#Check if the compiler supports certain attributes +OLDCFLAGS="$CFLAGS" +CFLAGS="-Werror" + +AH_TEMPLATE([C_ATTRIBUTE_ALWAYS_INLINE],[Determines if the compilers supports always_inline attribute.]) +AC_MSG_CHECKING(if compiler allows __attribute__((always_inline)) ) +AC_COMPILE_IFELSE([ void __attribute__((always_inline)) test(){} +],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_ALWAYS_INLINE)],AC_MSG_RESULT(no)) + +AH_TEMPLATE([C_ATTRIBUTE_FASTCALL],[Determines if the compilers supports fastcall attribute.]) +AC_MSG_CHECKING(if compiler allows __attribute__((fastcall)) ) +AC_COMPILE_IFELSE([ void __attribute__((fastcall)) test(){} +],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_FASTCALL)],AC_MSG_RESULT(no)) + + +CFLAGS="$OLDCFLAGS" + + #Check if the compiler supports __builtin_expect #Switch language to c++ AC_LANG_PUSH(C++) diff --git a/include/callback.h b/include/callback.h index faaa8bc0..1c438ec7 100644 --- a/include/callback.h +++ b/include/callback.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: callback.h,v 1.22 2009-01-14 22:16:00 qbix79 Exp $ */ +/* $Id: callback.h,v 1.23 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_CALLBACK_H #define DOSBOX_CALLBACK_H @@ -43,14 +43,14 @@ enum { extern Bit8u lastint; -INLINE RealPt CALLBACK_RealPointer(Bitu callback) { +static INLINE RealPt CALLBACK_RealPointer(Bitu callback) { return RealMake(CB_SEG,(Bit16u)(callback*CB_SIZE)); } -INLINE PhysPt CALLBACK_PhysPointer(Bitu callback) { +static INLINE PhysPt CALLBACK_PhysPointer(Bitu callback) { return PhysMake(CB_SEG,(Bit16u)(callback*CB_SIZE)); } -INLINE PhysPt CALLBACK_GetBase(void) { +static INLINE PhysPt CALLBACK_GetBase(void) { return CB_SEG << 4; } diff --git a/include/cpu.h b/include/cpu.h index 4a2d14aa..643fc182 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cpu.h,v 1.55 2008-08-24 16:43:06 qbix79 Exp $ */ +/* $Id: cpu.h,v 1.56 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_CPU_H #define DOSBOX_CPU_H @@ -144,13 +144,13 @@ void CPU_ENTER(bool use32,Bitu bytes,Bitu level); #define CPU_INT_NOIOPLCHECK 0x8 void CPU_Interrupt(Bitu num,Bitu type,Bitu oldeip); -INLINE void CPU_HW_Interrupt(Bitu num) { +static INLINE void CPU_HW_Interrupt(Bitu num) { CPU_Interrupt(num,0,reg_eip); } -INLINE void CPU_SW_Interrupt(Bitu num,Bitu oldeip) { +static INLINE void CPU_SW_Interrupt(Bitu num,Bitu oldeip) { CPU_Interrupt(num,CPU_INT_SOFTWARE,oldeip); } -INLINE void CPU_SW_Interrupt_NoIOPLCheck(Bitu num,Bitu oldeip) { +static INLINE void CPU_SW_Interrupt_NoIOPLCheck(Bitu num,Bitu oldeip) { CPU_Interrupt(num,CPU_INT_SOFTWARE|CPU_INT_NOIOPLCHECK,oldeip); } @@ -478,12 +478,12 @@ struct CPUBlock { extern CPUBlock cpu; -INLINE void CPU_SetFlagsd(Bitu word) { +static INLINE void CPU_SetFlagsd(Bitu word) { Bitu mask=cpu.cpl ? FMASK_NORMAL : FMASK_ALL; CPU_SetFlags(word,mask); } -INLINE void CPU_SetFlagsw(Bitu word) { +static INLINE void CPU_SetFlagsw(Bitu word) { Bitu mask=(cpu.cpl ? FMASK_NORMAL : FMASK_ALL) & 0xffff; CPU_SetFlags(word,mask); } diff --git a/include/dos_inc.h b/include/dos_inc.h index f3c6b833..e1d037a4 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.76 2008-09-06 14:47:02 c2woody Exp $ */ +/* $Id: dos_inc.h,v 1.77 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -208,18 +208,18 @@ enum { }; -INLINE Bit16u long2para(Bit32u size) { +static INLINE Bit16u long2para(Bit32u size) { if (size>0xFFFF0) return 0xffff; if (size&0xf) return (Bit16u)((size>>4)+1); else return (Bit16u)(size>>4); } -INLINE Bit16u DOS_PackTime(Bit16u hour,Bit16u min,Bit16u sec) { +static INLINE Bit16u DOS_PackTime(Bit16u hour,Bit16u min,Bit16u sec) { return (hour&0x1f)<<11 | (min&0x3f) << 5 | ((sec/2)&0x1f); } -INLINE Bit16u DOS_PackDate(Bit16u year,Bit16u mon,Bit16u day) { +static INLINE Bit16u DOS_PackDate(Bit16u year,Bit16u mon,Bit16u day) { return ((year-1980)&0x7f)<<9 | (mon&0x3f) << 5 | (day&0x1f); } @@ -254,7 +254,7 @@ INLINE Bit16u DOS_PackDate(Bit16u year,Bit16u mon,Bit16u day) { class MemStruct { public: - INLINE Bitu GetIt(Bitu size,PhysPt addr) { + Bitu GetIt(Bitu size,PhysPt addr) { switch (size) { case 1:return mem_readb(pt+addr); case 2:return mem_readw(pt+addr); @@ -262,16 +262,16 @@ public: } return 0; } - INLINE void SaveIt(Bitu size,PhysPt addr,Bitu val) { + void SaveIt(Bitu size,PhysPt addr,Bitu val) { switch (size) { case 1:mem_writeb(pt+addr,(Bit8u)val);break; case 2:mem_writew(pt+addr,(Bit16u)val);break; case 4:mem_writed(pt+addr,(Bit32u)val);break; } } - INLINE void SetPt(Bit16u seg) { pt=PhysMake(seg,0);} - INLINE void SetPt(Bit16u seg,Bit16u off) { pt=PhysMake(seg,off);} - INLINE void SetPt(RealPt addr) { pt=Real2Phys(addr);} + void SetPt(Bit16u seg) { pt=PhysMake(seg,0);} + void SetPt(Bit16u seg,Bit16u off) { pt=PhysMake(seg,off);} + void SetPt(RealPt addr) { pt=Real2Phys(addr);} protected: PhysPt pt; }; @@ -635,7 +635,7 @@ struct DOS_Block { extern DOS_Block dos; -INLINE Bit8u RealHandle(Bit16u handle) { +static Bit8u RealHandle(Bit16u handle) { DOS_PSP psp(dos.psp()); return psp.GetFileHandle(handle); } diff --git a/include/fpu.h b/include/fpu.h index 2c071801..92dd3aab 100644 --- a/include/fpu.h +++ b/include/fpu.h @@ -108,44 +108,44 @@ extern FPU_rec fpu; Bit16u FPU_GetTag(void); void FPU_FLDCW(PhysPt addr); -INLINE void FPU_SetTag(Bit16u tag){ +static INLINE void FPU_SetTag(Bit16u tag){ for(Bitu i=0;i<8;i++) fpu.tags[i] = static_cast((tag >>(2*i))&3); } -INLINE void FPU_SetCW(Bitu word){ +static INLINE void FPU_SetCW(Bitu word){ fpu.cw = (Bit16u)word; fpu.cw_mask_all = (Bit16u)(word | 0x3f); fpu.round = (FPU_Round)((word >> 10) & 3); } -INLINE Bitu FPU_GET_TOP(void) { +static INLINE Bitu FPU_GET_TOP(void) { return (fpu.sw & 0x3800)>>11; } -INLINE void FPU_SET_TOP(Bitu val){ +static INLINE void FPU_SET_TOP(Bitu val){ fpu.sw &= ~0x3800; fpu.sw |= (val&7)<<11; } -INLINE void FPU_SET_C0(Bitu C){ +static INLINE void FPU_SET_C0(Bitu C){ fpu.sw &= ~0x0100; if(C) fpu.sw |= 0x0100; } -INLINE void FPU_SET_C1(Bitu C){ +static INLINE void FPU_SET_C1(Bitu C){ fpu.sw &= ~0x0200; if(C) fpu.sw |= 0x0200; } -INLINE void FPU_SET_C2(Bitu C){ +static INLINE void FPU_SET_C2(Bitu C){ fpu.sw &= ~0x0400; if(C) fpu.sw |= 0x0400; } -INLINE void FPU_SET_C3(Bitu C){ +static INLINE void FPU_SET_C3(Bitu C){ fpu.sw &= ~0x4000; if(C) fpu.sw |= 0x4000; } diff --git a/include/inout.h b/include/inout.h index 06987c51..9e3c0329 100644 --- a/include/inout.h +++ b/include/inout.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: inout.h,v 1.11 2007-06-12 20:22:07 c2woody Exp $ */ +/* $Id: inout.h,v 1.12 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_INOUT_H #define DOSBOX_INOUT_H @@ -68,10 +68,10 @@ public: ~IO_WriteHandleObject(); }; -INLINE void IO_Write(Bitu port,Bit8u val) { +static INLINE void IO_Write(Bitu port,Bit8u val) { IO_WriteB(port,val); } -INLINE Bit8u IO_Read(Bitu port){ +static INLINE Bit8u IO_Read(Bitu port){ return (Bit8u)IO_ReadB(port); } diff --git a/include/mem.h b/include/mem.h index f9128dad..7a2cfb99 100644 --- a/include/mem.h +++ b/include/mem.h @@ -59,23 +59,23 @@ MemHandle MEM_NextHandleAt(MemHandle handle,Bitu where); #if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY) -INLINE Bit8u host_readb(HostPt off) { +static 4/25/2009INLINE Bit8u host_readb(HostPt off) { return off[0]; } -INLINE Bit16u host_readw(HostPt off) { +static INLINE Bit16u host_readw(HostPt off) { return off[0] | (off[1] << 8); } -INLINE Bit32u host_readd(HostPt off) { +static INLINE Bit32u host_readd(HostPt off) { return off[0] | (off[1] << 8) | (off[2] << 16) | (off[3] << 24); } -INLINE void host_writeb(HostPt off,Bit8u val) { +static INLINE void host_writeb(HostPt off,Bit8u val) { off[0]=val; } -INLINE void host_writew(HostPt off,Bit16u val) { +static INLINE void host_writew(HostPt off,Bit16u val) { off[0]=(Bit8u)(val); off[1]=(Bit8u)(val >> 8); } -INLINE void host_writed(HostPt off,Bit32u val) { +static INLINE void host_writed(HostPt off,Bit32u val) { off[0]=(Bit8u)(val); off[1]=(Bit8u)(val >> 8); off[2]=(Bit8u)(val >> 16); @@ -84,37 +84,37 @@ INLINE void host_writed(HostPt off,Bit32u val) { #else -INLINE Bit8u host_readb(HostPt off) { +static INLINE Bit8u host_readb(HostPt off) { return *(Bit8u *)off; } -INLINE Bit16u host_readw(HostPt off) { +static INLINE Bit16u host_readw(HostPt off) { return *(Bit16u *)off; } -INLINE Bit32u host_readd(HostPt off) { +static INLINE Bit32u host_readd(HostPt off) { return *(Bit32u *)off; } -INLINE void host_writeb(HostPt off,Bit8u val) { +static INLINE void host_writeb(HostPt off,Bit8u val) { *(Bit8u *)(off)=val; } -INLINE void host_writew(HostPt off,Bit16u val) { +static INLINE void host_writew(HostPt off,Bit16u val) { *(Bit16u *)(off)=val; } -INLINE void host_writed(HostPt off,Bit32u val) { +static INLINE void host_writed(HostPt off,Bit32u val) { *(Bit32u *)(off)=val; } #endif -INLINE void var_write(Bit8u * var, Bit8u val) { +static INLINE void var_write(Bit8u * var, Bit8u val) { host_writeb((HostPt)var, val); } -INLINE void var_write(Bit16u * var, Bit16u val) { +static INLINE void var_write(Bit16u * var, Bit16u val) { host_writew((HostPt)var, val); } -INLINE void var_write(Bit32u * var, Bit32u val) { +static INLINE void var_write(Bit32u * var, Bit32u val) { host_writed((HostPt)var, val); } @@ -128,23 +128,23 @@ void mem_writeb(PhysPt pt,Bit8u val); void mem_writew(PhysPt pt,Bit16u val); void mem_writed(PhysPt pt,Bit32u val); -INLINE void phys_writeb(PhysPt addr,Bit8u val) { +static INLINE void phys_writeb(PhysPt addr,Bit8u val) { host_writeb(MemBase+addr,val); } -INLINE void phys_writew(PhysPt addr,Bit16u val){ +static INLINE void phys_writew(PhysPt addr,Bit16u val){ host_writew(MemBase+addr,val); } -INLINE void phys_writed(PhysPt addr,Bit32u val){ +static INLINE void phys_writed(PhysPt addr,Bit32u val){ host_writed(MemBase+addr,val); } -INLINE Bit8u phys_readb(PhysPt addr) { +static INLINE Bit8u phys_readb(PhysPt addr) { return host_readb(MemBase+addr); } -INLINE Bit16u phys_readw(PhysPt addr){ +static INLINE Bit16u phys_readw(PhysPt addr){ return host_readw(MemBase+addr); } -INLINE Bit32u phys_readd(PhysPt addr){ +static INLINE Bit32u phys_readd(PhysPt addr){ return host_readd(MemBase+addr); } @@ -161,57 +161,57 @@ void mem_strcpy(PhysPt dest,PhysPt src); /* The folowing functions are all shortcuts to the above functions using physical addressing */ -INLINE Bit8u real_readb(Bit16u seg,Bit16u off) { +static INLINE Bit8u real_readb(Bit16u seg,Bit16u off) { return mem_readb((seg<<4)+off); } -INLINE Bit16u real_readw(Bit16u seg,Bit16u off) { +static INLINE Bit16u real_readw(Bit16u seg,Bit16u off) { return mem_readw((seg<<4)+off); } -INLINE Bit32u real_readd(Bit16u seg,Bit16u off) { +static INLINE Bit32u real_readd(Bit16u seg,Bit16u off) { return mem_readd((seg<<4)+off); } -INLINE void real_writeb(Bit16u seg,Bit16u off,Bit8u val) { +static INLINE void real_writeb(Bit16u seg,Bit16u off,Bit8u val) { mem_writeb(((seg<<4)+off),val); } -INLINE void real_writew(Bit16u seg,Bit16u off,Bit16u val) { +static INLINE void real_writew(Bit16u seg,Bit16u off,Bit16u val) { mem_writew(((seg<<4)+off),val); } -INLINE void real_writed(Bit16u seg,Bit16u off,Bit32u val) { +static INLINE void real_writed(Bit16u seg,Bit16u off,Bit32u val) { mem_writed(((seg<<4)+off),val); } -INLINE Bit16u RealSeg(RealPt pt) { +static INLINE Bit16u RealSeg(RealPt pt) { return (Bit16u)(pt>>16); } -INLINE Bit16u RealOff(RealPt pt) { +static INLINE Bit16u RealOff(RealPt pt) { return (Bit16u)(pt&0xffff); } -INLINE PhysPt Real2Phys(RealPt pt) { +static INLINE PhysPt Real2Phys(RealPt pt) { return (RealSeg(pt)<<4) +RealOff(pt); } -INLINE PhysPt PhysMake(Bit16u seg,Bit16u off) { +static INLINE PhysPt PhysMake(Bit16u seg,Bit16u off) { return (seg<<4)+off; } -INLINE RealPt RealMake(Bit16u seg,Bit16u off) { +static INLINE RealPt RealMake(Bit16u seg,Bit16u off) { return (seg<<16)+off; } -INLINE void RealSetVec(Bit8u vec,RealPt pt) { +static INLINE void RealSetVec(Bit8u vec,RealPt pt) { mem_writed(vec<<2,pt); } -INLINE void RealSetVec(Bit8u vec,RealPt pt,RealPt &old) { +static INLINE void RealSetVec(Bit8u vec,RealPt pt,RealPt &old) { old = mem_readd(vec<<2); mem_writed(vec<<2,pt); } -INLINE RealPt RealGetVec(Bit8u vec) { +static INLINE RealPt RealGetVec(Bit8u vec) { return mem_readd(vec<<2); } diff --git a/include/mixer.h b/include/mixer.h index a614f524..d8585a35 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mixer.h,v 1.17 2009-03-19 20:45:42 c2woody Exp $ */ +/* $Id: mixer.h,v 1.18 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_MIXER_H #define DOSBOX_MIXER_H @@ -52,8 +52,10 @@ public: void SetFreq(Bitu _freq); void Mix(Bitu _needed); void AddSilence(void); //Fill up until needed + template void AddSamples(Bitu len, const Type* data); + void AddSamples_m8(Bitu len, const Bit8u * data); void AddSamples_s8(Bitu len, const Bit8u * data); void AddSamples_m8s(Bitu len, const Bit8s * data); diff --git a/include/paging.h b/include/paging.h index d9935b14..1b09a109 100644 --- a/include/paging.h +++ b/include/paging.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.h,v 1.31 2008-01-05 21:04:43 c2woody Exp $ */ +/* $Id: paging.h,v 1.32 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_PAGING_H #define DOSBOX_PAGING_H @@ -197,25 +197,25 @@ bool mem_unalignedwrited_checked(PhysPt address,Bit32u val); #if defined(USE_FULL_TLB) -INLINE HostPt get_tlb_read(PhysPt address) { +static INLINE HostPt get_tlb_read(PhysPt address) { return paging.tlb.read[address>>12]; } -INLINE HostPt get_tlb_write(PhysPt address) { +static INLINE HostPt get_tlb_write(PhysPt address) { return paging.tlb.write[address>>12]; } -INLINE PageHandler* get_tlb_readhandler(PhysPt address) { +static INLINE PageHandler* get_tlb_readhandler(PhysPt address) { return paging.tlb.readhandler[address>>12]; } -INLINE PageHandler* get_tlb_writehandler(PhysPt address) { +static INLINE PageHandler* get_tlb_writehandler(PhysPt address) { return paging.tlb.writehandler[address>>12]; } /* Use these helper functions to access linear addresses in readX/writeX functions */ -INLINE PhysPt PAGING_GetPhysicalPage(PhysPt linePage) { +static INLINE PhysPt PAGING_GetPhysicalPage(PhysPt linePage) { return (paging.tlb.phys_page[linePage>>12]<<12); } -INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) { +static INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) { return (paging.tlb.phys_page[linAddr>>12]<<12)|(linAddr&0xfff); } @@ -223,7 +223,7 @@ INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) { void PAGING_InitTLBBank(tlb_entry **bank); -INLINE tlb_entry *get_tlb_entry(PhysPt address) { +static INLINE tlb_entry *get_tlb_entry(PhysPt address) { Bitu index=(address>>12); if (TLB_BANKS && (index > TLB_SIZE)) { Bitu bank=(address>>BANK_SHIFT) - 1; @@ -234,26 +234,26 @@ INLINE tlb_entry *get_tlb_entry(PhysPt address) { return &paging.tlbh[index]; } -INLINE HostPt get_tlb_read(PhysPt address) { +static INLINE HostPt get_tlb_read(PhysPt address) { return get_tlb_entry(address)->read; } -INLINE HostPt get_tlb_write(PhysPt address) { +static INLINE HostPt get_tlb_write(PhysPt address) { return get_tlb_entry(address)->write; } -INLINE PageHandler* get_tlb_readhandler(PhysPt address) { +static INLINE PageHandler* get_tlb_readhandler(PhysPt address) { return get_tlb_entry(address)->readhandler; } -INLINE PageHandler* get_tlb_writehandler(PhysPt address) { +static INLINE PageHandler* get_tlb_writehandler(PhysPt address) { return get_tlb_entry(address)->writehandler; } /* Use these helper functions to access linear addresses in readX/writeX functions */ -INLINE PhysPt PAGING_GetPhysicalPage(PhysPt linePage) { +static INLINE PhysPt PAGING_GetPhysicalPage(PhysPt linePage) { tlb_entry *entry = get_tlb_entry(linePage); return (entry->phys_page<<12); } -INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) { +static INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) { tlb_entry *entry = get_tlb_entry(linAddr); return (entry->phys_page<<12)|(linAddr&0xfff); } @@ -261,13 +261,13 @@ INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) { /* Special inlined memory reading/writing */ -INLINE Bit8u mem_readb_inline(PhysPt address) { +static INLINE Bit8u mem_readb_inline(PhysPt address) { HostPt tlb_addr=get_tlb_read(address); if (tlb_addr) return host_readb(tlb_addr+address); else return (Bit8u)(get_tlb_readhandler(address))->readb(address); } -INLINE Bit16u mem_readw_inline(PhysPt address) { +static INLINE Bit16u mem_readw_inline(PhysPt address) { if ((address & 0xfff)<0xfff) { HostPt tlb_addr=get_tlb_read(address); if (tlb_addr) return host_readw(tlb_addr+address); @@ -275,7 +275,7 @@ INLINE Bit16u mem_readw_inline(PhysPt address) { } else return mem_unalignedreadw(address); } -INLINE Bit32u mem_readd_inline(PhysPt address) { +static INLINE Bit32u mem_readd_inline(PhysPt address) { if ((address & 0xfff)<0xffd) { HostPt tlb_addr=get_tlb_read(address); if (tlb_addr) return host_readd(tlb_addr+address); @@ -283,13 +283,13 @@ INLINE Bit32u mem_readd_inline(PhysPt address) { } else return mem_unalignedreadd(address); } -INLINE void mem_writeb_inline(PhysPt address,Bit8u val) { +static INLINE void mem_writeb_inline(PhysPt address,Bit8u val) { HostPt tlb_addr=get_tlb_write(address); if (tlb_addr) host_writeb(tlb_addr+address,val); else (get_tlb_writehandler(address))->writeb(address,val); } -INLINE void mem_writew_inline(PhysPt address,Bit16u val) { +static INLINE void mem_writew_inline(PhysPt address,Bit16u val) { if ((address & 0xfff)<0xfff) { HostPt tlb_addr=get_tlb_write(address); if (tlb_addr) host_writew(tlb_addr+address,val); @@ -297,7 +297,7 @@ INLINE void mem_writew_inline(PhysPt address,Bit16u val) { } else mem_unalignedwritew(address,val); } -INLINE void mem_writed_inline(PhysPt address,Bit32u val) { +static INLINE void mem_writed_inline(PhysPt address,Bit32u val) { if ((address & 0xfff)<0xffd) { HostPt tlb_addr=get_tlb_write(address); if (tlb_addr) host_writed(tlb_addr+address,val); @@ -306,7 +306,7 @@ INLINE void mem_writed_inline(PhysPt address,Bit32u val) { } -INLINE bool mem_readb_checked(PhysPt address, Bit8u * val) { +static INLINE bool mem_readb_checked(PhysPt address, Bit8u * val) { HostPt tlb_addr=get_tlb_read(address); if (tlb_addr) { *val=host_readb(tlb_addr+address); @@ -314,7 +314,7 @@ INLINE bool mem_readb_checked(PhysPt address, Bit8u * val) { } else return (get_tlb_readhandler(address))->readb_checked(address, val); } -INLINE bool mem_readw_checked(PhysPt address, Bit16u * val) { +static INLINE bool mem_readw_checked(PhysPt address, Bit16u * val) { if ((address & 0xfff)<0xfff) { HostPt tlb_addr=get_tlb_read(address); if (tlb_addr) { @@ -324,7 +324,7 @@ INLINE bool mem_readw_checked(PhysPt address, Bit16u * val) { } else return mem_unalignedreadw_checked(address, val); } -INLINE bool mem_readd_checked(PhysPt address, Bit32u * val) { +static INLINE bool mem_readd_checked(PhysPt address, Bit32u * val) { if ((address & 0xfff)<0xffd) { HostPt tlb_addr=get_tlb_read(address); if (tlb_addr) { @@ -334,7 +334,7 @@ INLINE bool mem_readd_checked(PhysPt address, Bit32u * val) { } else return mem_unalignedreadd_checked(address, val); } -INLINE bool mem_writeb_checked(PhysPt address,Bit8u val) { +static INLINE bool mem_writeb_checked(PhysPt address,Bit8u val) { HostPt tlb_addr=get_tlb_write(address); if (tlb_addr) { host_writeb(tlb_addr+address,val); @@ -342,7 +342,7 @@ INLINE bool mem_writeb_checked(PhysPt address,Bit8u val) { } else return (get_tlb_writehandler(address))->writeb_checked(address,val); } -INLINE bool mem_writew_checked(PhysPt address,Bit16u val) { +static INLINE bool mem_writew_checked(PhysPt address,Bit16u val) { if ((address & 0xfff)<0xfff) { HostPt tlb_addr=get_tlb_write(address); if (tlb_addr) { @@ -352,7 +352,7 @@ INLINE bool mem_writew_checked(PhysPt address,Bit16u val) { } else return mem_unalignedwritew_checked(address,val); } -INLINE bool mem_writed_checked(PhysPt address,Bit32u val) { +static INLINE bool mem_writed_checked(PhysPt address,Bit32u val) { if ((address & 0xfff)<0xffd) { HostPt tlb_addr=get_tlb_write(address); if (tlb_addr) { diff --git a/include/pic.h b/include/pic.h index 420a1fe5..9d68e6b0 100644 --- a/include/pic.h +++ b/include/pic.h @@ -36,19 +36,19 @@ extern Bitu PIC_IRQCheck; extern Bitu PIC_IRQActive; extern Bitu PIC_Ticks; -INLINE float PIC_TickIndex(void) { +static INLINE float PIC_TickIndex(void) { return (CPU_CycleMax-CPU_CycleLeft-CPU_Cycles)/(float)CPU_CycleMax; } -INLINE Bits PIC_TickIndexND(void) { +static INLINE Bits PIC_TickIndexND(void) { return CPU_CycleMax-CPU_CycleLeft-CPU_Cycles; } -INLINE Bits PIC_MakeCycles(double amount) { +static INLINE Bits PIC_MakeCycles(double amount) { return (Bits)(CPU_CycleMax*amount); } -INLINE double PIC_FullIndex(void) { +static INLINE double PIC_FullIndex(void) { return PIC_Ticks+(double)PIC_TickIndex(); } diff --git a/include/regs.h b/include/regs.h index 8f8445f4..59d7a761 100644 --- a/include/regs.h +++ b/include/regs.h @@ -93,20 +93,20 @@ struct CPU_Regs { extern Segments Segs; extern CPU_Regs cpu_regs; -INLINE PhysPt SegPhys(SegNames index) { +static INLINE PhysPt SegPhys(SegNames index) { return Segs.phys[index]; } -INLINE Bit16u SegValue(SegNames index) { +static INLINE Bit16u SegValue(SegNames index) { return (Bit16u)Segs.val[index]; } -INLINE RealPt RealMakeSeg(SegNames index,Bit16u off) { +static INLINE RealPt RealMakeSeg(SegNames index,Bit16u off) { return RealMake(SegValue(index),off); } -INLINE void SegSet16(Bitu index,Bit16u val) { +static INLINE void SegSet16(Bitu index,Bit16u val) { Segs.val[index]=val; Segs.phys[index]=val << 4; } diff --git a/include/support.h b/include/support.h index 5933de19..3c10a386 100644 --- a/include/support.h +++ b/include/support.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.h,v 1.16 2008-01-13 11:28:41 qbix79 Exp $ */ +/* $Id: support.h,v 1.17 2009-04-25 16:25:03 harekiet Exp $ */ #ifndef DOSBOX_SUPPORT_H #define DOSBOX_SUPPORT_H @@ -43,6 +43,8 @@ void strreplace(char * str,char o,char n); char *ltrim(char *str); char *rtrim(char *str); char *trim(char * str); +char * upcase(char * str); +char * lowcase(char * str); bool ScanCMDBool(char * cmd,char const * const check); char * ScanCMDRemain(char * cmd); @@ -52,16 +54,6 @@ bool IsHexWord(char * word); Bits ConvDecWord(char * word); Bits ConvHexWord(char * word); -INLINE char * upcase(char * str) { - for (char* idx = str; *idx ; idx++) *idx = toupper(*reinterpret_cast(idx)); - return str; -} - -INLINE char * lowcase(char * str) { - for(char* idx = str; *idx ; idx++) *idx = tolower(*reinterpret_cast(idx)); - return str; -} - void upcase(std::string &str); void lowcase(std::string &str); diff --git a/src/hardware/dbopl.cpp b/src/hardware/dbopl.cpp index 1d12af12..be8830cd 100644 --- a/src/hardware/dbopl.cpp +++ b/src/hardware/dbopl.cpp @@ -218,26 +218,26 @@ static inline Bits MakeVolume( Bitu wave, Bitu volume ) { return (sig >> exp); }; -static Bits FASTCALL WaveForm0( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm0( Bitu i, Bitu volume ) { Bits neg = 0 - (( i >> 9) & 1);//Create ~0 or 0 Bitu wave = SinTable[i & 511]; return (MakeVolume( wave, volume ) ^ neg) - neg; } -static Bits FASTCALL WaveForm1( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm1( Bitu i, Bitu volume ) { Bit32u wave = SinTable[i & 511]; wave |= ( ( (i ^ 512 ) & 512) - 1) >> ( 32 - 12 ); return MakeVolume( wave, volume ); } -static Bits FASTCALL WaveForm2( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm2( Bitu i, Bitu volume ) { Bitu wave = SinTable[i & 511]; return MakeVolume( wave, volume ); } -static Bits FASTCALL WaveForm3( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm3( Bitu i, Bitu volume ) { Bitu wave = SinTable[i & 255]; wave |= ( ( (i ^ 256 ) & 256) - 1) >> ( 32 - 12 ); return MakeVolume( wave, volume ); } -static Bits FASTCALL WaveForm4( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm4( Bitu i, Bitu volume ) { //Twice as fast i <<= 1; Bits neg = 0 - (( i >> 9) & 1);//Create ~0 or 0 @@ -245,18 +245,18 @@ static Bits FASTCALL WaveForm4( Bitu i, Bitu volume ) { wave |= ( ( (i ^ 512 ) & 512) - 1) >> ( 32 - 12 ); return (MakeVolume( wave, volume ) ^ neg) - neg; } -static Bits FASTCALL WaveForm5( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm5( Bitu i, Bitu volume ) { //Twice as fast i <<= 1; Bitu wave = SinTable[i & 511]; wave |= ( ( (i ^ 512 ) & 512) - 1) >> ( 32 - 12 ); return MakeVolume( wave, volume ); } -static Bits FASTCALL WaveForm6( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm6( Bitu i, Bitu volume ) { Bits neg = 0 - (( i >> 9) & 1);//Create ~0 or 0 return (MakeVolume( 0, volume ) ^ neg) - neg; } -static Bits FASTCALL WaveForm7( Bitu i, Bitu volume ) { +static Bits DB_FASTCALL WaveForm7( Bitu i, Bitu volume ) { //Negative is reversed here Bits neg = (( i >> 9) & 1) - 1; Bitu wave = (i << 3); diff --git a/src/hardware/dbopl.h b/src/hardware/dbopl.h index 2d08bf7b..f42a330d 100644 --- a/src/hardware/dbopl.h +++ b/src/hardware/dbopl.h @@ -40,7 +40,7 @@ struct Operator; struct Channel; #if (DBOPL_WAVE == WAVE_HANDLER) -typedef Bits ( FASTCALL *WaveHandler) ( Bitu i, Bitu volume ); +typedef Bits ( DB_FASTCALL *WaveHandler) ( Bitu i, Bitu volume ); #endif typedef Bits ( DBOPL::Operator::*VolumeHandler) ( ); @@ -247,4 +247,4 @@ struct Handler : public Adlib::Handler { }; -}; //Namespace \ No newline at end of file +}; //Namespace diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index fc8a4d98..3c8cb9f8 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mixer.cpp,v 1.50 2009-03-19 20:45:42 c2woody Exp $ */ +/* $Id: mixer.cpp,v 1.51 2009-04-25 16:25:03 harekiet Exp $ */ /* Remove the sdl code from here and have it handeld in the sdlmain. @@ -55,7 +55,7 @@ #define MIXER_REMAIN ((1< MIN_AUDIO) return SAMP; @@ -175,7 +175,7 @@ void MixerChannel::AddSilence(void) { } template -INLINE void MixerChannel::AddSamples(Bitu len, const Type* data) { +inline void MixerChannel::AddSamples(Bitu len, const Type* data) { Bits diff[2]; Bitu mixpos=mixer.pos+done; freq_index&=MIXER_REMAIN; diff --git a/src/ints/int10.h b/src/ints/int10.h index 6eae71e3..9f84ed03 100644 --- a/src/ints/int10.h +++ b/src/ints/int10.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10.h,v 1.37 2009-04-11 07:58:39 qbix79 Exp $ */ +/* $Id: int10.h,v 1.38 2009-04-25 16:25:03 harekiet Exp $ */ #include "vga.h" @@ -146,11 +146,11 @@ typedef struct { extern Int10Data int10; -INLINE Bit8u CURSOR_POS_COL(Bit8u page) { +static Bit8u CURSOR_POS_COL(Bit8u page) { return real_readb(BIOSMEM_SEG,BIOSMEM_CURSOR_POS+page*2); } -INLINE Bit8u CURSOR_POS_ROW(Bit8u page) { +static Bit8u CURSOR_POS_ROW(Bit8u page) { return real_readb(BIOSMEM_SEG,BIOSMEM_CURSOR_POS+page*2+1); } diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index 6789be59..c4c201e2 100644 --- a/src/ints/int10_char.cpp +++ b/src/ints/int10_char.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_char.cpp,v 1.56 2008-11-09 11:22:03 qbix79 Exp $ */ +/* $Id: int10_char.cpp,v 1.57 2009-04-25 16:25:03 harekiet Exp $ */ /* Character displaying moving functions */ @@ -26,7 +26,7 @@ #include "inout.h" #include "int10.h" -static INLINE void CGA2_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { +static void CGA2_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+((CurMode->twidth*rnew)*(cheight/2)+cleft); PhysPt src=base+((CurMode->twidth*rold)*(cheight/2)+cleft); @@ -39,7 +39,7 @@ static INLINE void CGA2_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,P } } -static INLINE void CGA4_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { +static void CGA4_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+((CurMode->twidth*rnew)*(cheight/2)+cleft)*2; PhysPt src=base+((CurMode->twidth*rold)*(cheight/2)+cleft)*2; @@ -51,7 +51,7 @@ static INLINE void CGA4_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,P } } -static INLINE void TANDY16_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { +static void TANDY16_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+((CurMode->twidth*rnew)*(cheight/4)+cleft)*4; PhysPt src=base+((CurMode->twidth*rold)*(cheight/4)+cleft)*4; @@ -65,7 +65,7 @@ static INLINE void TANDY16_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rne } } -static INLINE void EGA16_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { +static void EGA16_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { PhysPt src,dest;Bitu copy; Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); dest=base+(CurMode->twidth*rnew)*cheight+cleft; @@ -85,7 +85,7 @@ static INLINE void EGA16_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew, IO_Write(0x3ce,5);IO_Write(0x3cf,0); /* Normal transfer mode */ } -static INLINE void VGA_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { +static void VGA_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { PhysPt src,dest;Bitu copy; Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); dest=base+8*((CurMode->twidth*rnew)*cheight+cleft); @@ -99,14 +99,14 @@ static INLINE void VGA_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,Ph } } -static INLINE void TEXT_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { +static void TEXT_CopyRow(Bit8u cleft,Bit8u cright,Bit8u rold,Bit8u rnew,PhysPt base) { PhysPt src,dest; src=base+(rold*CurMode->twidth+cleft)*2; dest=base+(rnew*CurMode->twidth+cleft)*2; MEM_BlockCopy(dest,src,(cright-cleft)*2); } -static INLINE void CGA2_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { +static void CGA2_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+((CurMode->twidth*row)*(cheight/2)+cleft); Bitu copy=(cright-cleft); @@ -122,7 +122,7 @@ static INLINE void CGA2_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,B } -static INLINE void CGA4_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { +static void CGA4_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+((CurMode->twidth*row)*(cheight/2)+cleft)*2; Bitu copy=(cright-cleft)*2;Bitu nextline=CurMode->twidth*2; @@ -136,7 +136,7 @@ static INLINE void CGA4_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,B } } -static INLINE void TANDY16_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { +static void TANDY16_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+((CurMode->twidth*row)*(cheight/4)+cleft)*4; Bitu copy=(cright-cleft)*4;Bitu nextline=CurMode->twidth*4; @@ -152,7 +152,7 @@ static INLINE void TANDY16_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt bas } } -static INLINE void EGA16_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { +static void EGA16_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { /* Set Bitmask / Color / Full Set Reset */ IO_Write(0x3ce,0x8);IO_Write(0x3cf,0xff); IO_Write(0x3ce,0x0);IO_Write(0x3cf,attr); @@ -169,7 +169,7 @@ static INLINE void EGA16_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base, IO_Write(0x3cf,0); } -static INLINE void VGA_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { +static void VGA_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { /* Write some bytes */ Bit8u cheight = real_readb(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT); PhysPt dest=base+8*((CurMode->twidth*row)*cheight+cleft); @@ -181,7 +181,7 @@ static INLINE void VGA_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bi } } -static INLINE void TEXT_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { +static void TEXT_FillRow(Bit8u cleft,Bit8u cright,Bit8u row,PhysPt base,Bit8u attr) { /* Do some filing */ PhysPt dest; dest=base+(row*CurMode->twidth+cleft)*2; @@ -549,7 +549,7 @@ void INT10_WriteChar(Bit8u chr,Bit8u attr,Bit8u page,Bit16u count,bool showattr) } } -static INLINE void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr,Bit8u page) { +static void INT10_TeletypeOutputAttr(Bit8u chr,Bit8u attr,bool useattr,Bit8u page) { BIOS_NCOLS;BIOS_NROWS; Bit8u cur_row=CURSOR_POS_ROW(page); Bit8u cur_col=CURSOR_POS_COL(page); diff --git a/src/misc/support.cpp b/src/misc/support.cpp index 7851cbe7..18552eab 100644 --- a/src/misc/support.cpp +++ b/src/misc/support.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.cpp,v 1.35 2008-08-06 18:32:35 c2woody Exp $ */ +/* $Id: support.cpp,v 1.36 2009-04-25 16:25:03 harekiet Exp $ */ #include #include @@ -80,6 +80,17 @@ char *trim(char *str) { return ltrim(rtrim(str)); } +char * upcase(char * str) { + for (char* idx = str; *idx ; idx++) *idx = toupper(*reinterpret_cast(idx)); + return str; +} + +char * lowcase(char * str) { + for(char* idx = str; *idx ; idx++) *idx = tolower(*reinterpret_cast(idx)); + return str; +} + + bool ScanCMDBool(char * cmd,char const * const check) { char * scan=cmd;size_t c_len=strlen(check); diff --git a/src/platform/visualc/config.h b/src/platform/visualc/config.h index 630e8b5f..75e9c0cf 100644 --- a/src/platform/visualc/config.h +++ b/src/platform/visualc/config.h @@ -1,8 +1,5 @@ -#define INLINE __forceinline - #define VERSION "0.72" - /* Define to 1 to enable internal debugger, requires libcurses */ #define C_DEBUG 0 @@ -58,6 +55,9 @@ #define GCC_ATTRIBUTE(x) /* attribute not supported */ #define GCC_UNLIKELY(x) (x) +#define INLINE __forceinline +#define DB_FASTCALL __fastcall + #if defined(_MSC_VER) && (_MSC_VER >= 1400) #pragma warning(disable : 4996) #endif