NLMISC Namespace Reference


Detailed Description

This namespace contains all miscellaneous class used by other module.


Data Structures

class  CAABBox
class  CAABBoxExt
struct  CAngleAxis
class  CAsyncFileManager
class  CAsyncFileManager::CFileLoad
class  CAsyncFileManager::CMultipleFileLoad
class  CAsyncFileManager::CSignal
class  CAsyncFileManager::ICancelCallback
class  CAutoTimer
class  CAutoTimerInst
class  CBGRA
class  CBigFile
struct  CBigFile::BNP
struct  CBigFile::BNPFile
class  CBigFile::CBNPFileComp
struct  CBigFile::CHandleFile
class  CBigFile::CThreadFileArray
class  CBitmap
class  CBitMemStream
class  CBitSet
class  CBlockMemory
struct  CBlockMemory::CBlock
 a block. More...

class  CBMSDbgInfo
class  CBSphere
class  CBSPNode2v
class  CBufFIFO
class  CCategoryMap
class  CClassId
class  CClassRegistry
struct  CClassRegistry::CClassNode
class  CConcavePolygonsVertexDesc
class  CConfigFile
struct  CConfigFile::CVar
class  CContiguousBlockAllocator
struct  CCpuInfo___
class  CDbgPtr
class  CDbgRefCount
class  CEidHash
struct  CEntityId
class  CEntityIdTranslator
struct  CEntityIdTranslator::CEntity
class  CEvalNumExpr
class  CEvent
class  CEventActivate
class  CEventChar
class  CEventDestroyWindow
class  CEventEmitterMulti
class  CEventKey
class  CEventKeyDown
class  CEventKeyUp
class  CEventListenerAsync
class  CEventMouse
class  CEventMouseDblClk
class  CEventMouseDown
class  CEventMouseMove
class  CEventMouseUp
class  CEventMouseWheel
class  CEventServer
class  CEventSetFocus
class  CFairMutex
class  CFairSynchronized
class  CFairSynchronized::CAccessor
class  CFastMem
class  CFastMutex
class  CFastMutexMP
struct  CFile
class  CFileDisplayer
struct  CFileEntry
class  CFixedSizeAllocator
class  CFixedSizeAllocator::CChunk
class  CFixedSizeAllocator::CNode
struct  CGameDeviceDesc
 Describe a game device. More...

class  CGameDeviceEvent
class  CGDAxisMoved
 An axis has moved. More...

class  CGDButton
class  CGDButtonDown
class  CGDButtonUp
class  CGDMouseMove
 A raw mouse move message, expressed in mickeys (relative values). More...

class  CGDPOVChanged
 A point of view control changed. More...

class  CGDSliderMoved
 A slider position has changed. More...

class  CHashBySheetId
struct  CHashFunctionUInt64
class  CHeapAllocator
struct  CHeapAllocator::CCategory
struct  CHeapAllocator::CFreeNode
struct  CHeapAllocator::CMainBlock
struct  CHeapAllocator::CMemoryLeakBlock
struct  CHeapAllocator::CNodeBegin
struct  CHeapAllocator::CNodeEnd
struct  CHeapAllocator::CNullNode
struct  CHeapAllocator::CSmallBlockPool
class  CHeapMemory
struct  CHeapMemory::CEmptySpace
class  CHTimer
struct  CHTimer::CExamStackEntry
struct  CHTimer::CNode
 a node in an execution path More...

struct  CHTimer::CNodeStat
struct  CHTimer::CStats
struct  CHTimer::CStatSorter
struct  CHTimer::CTimerStat
class  CI18N
struct  CI18N::ILoadProxy
class  CIFile
struct  CInputDeviceEventLess
class  CInputDeviceServer
struct  CLeak
class  CLightMemDisplayer
class  CLine
class  CLineColor
class  CLineColorUV
class  CLineUV
class  CLog
struct  CLog::TDisplayInfo
class  CMatrix
class  CMemDisplayer
class  CMemStream
class  CMouseSmoother
class  CMouseSmoother::CSample
class  CMsgBoxDisplayer
class  CNoiseColorGradient
class  CNoiseValue
class  CObjectArenaAllocator
class  CObjectVector
class  CObjectVector< double, true >
class  CObjectVector< float, true >
class  CObjectVector< sint16, true >
class  CObjectVector< sint32, true >
class  CObjectVector< sint64, true >
class  CObjectVector< sint8, true >
class  CObjectVector< uint16, true >
class  CObjectVector< uint32, true >
class  CObjectVector< uint64, true >
class  CObjectVector< uint8, true >
class  COFile
class  COXml
class  CPath
struct  CPath::CFileEntry
class  CPath::CMCFileComp
struct  CPath::CMCFileEntry
class  CPlane
class  CPolygon
class  CPolygon2D
class  CPoolMemory
class  CQuad
class  CQuadColor
class  CQuadColorUV
class  CQuadColorUV2
class  CQuadUV
class  CQuat
class  CQuatD
class  CQuatT
class  CRandom
class  CRandomGrid3D
 A static 3D array of random value + other infos for noise. More...

class  CReaderWriter
class  CRect
class  CRefCount
struct  CRefCount::CPtrInfo
class  CRefPtr
class  CRGBA
class  CRGBAF
class  CRWSynchronized
class  CRWSynchronized::CReadAccessor
class  CRWSynchronized::CWriteAccessor
struct  CSerialCommand
class  CSharedMemory
class  CSharedMutex
class  CSheetId
class  CSheetId::CChar
 associate sheet id and sheet name More...

class  CSheetId::CCharComp
union  CSheetId::TSheetId
 sheet id More...

class  CSimpleClock
class  CSingleton
class  CSmartPtr
class  CSString
class  CStaticMap
class  CStaticMap::value_compare
class  CStaticStringMapper
class  CstCDbgPtr
class  CStdDisplayer
class  CSTLBlockAllocator
class  CSTLBlockList
class  CStopWatch
class  CStringConversion
struct  CStringConversion::CPair
class  CStringIdArray
class  CStringMapper
class  CStringMapper::CCharComp
class  CStringStream
class  CSystemInfo
class  CTaskManager
class  CTaskManager::CWaitingTask
class  CTaskManager::IChangeTaskPriority
 A callback to modify the task priority. More...

class  CTDS
class  CTime
struct  CTraits
struct  CTraits< bool >
struct  CTraits< char >
struct  CTraits< CRGBA >
struct  CTraits< CVector >
struct  CTraits< double >
struct  CTraits< float >
struct  CTraits< sint >
struct  CTraits< sint16 >
struct  CTraits< sint32 >
struct  CTraits< sint64 >
struct  CTraits< sint8 >
struct  CTraits< uint >
struct  CTraits< uint16 >
struct  CTraits< uint32 >
struct  CTraits< uint64 >
struct  CTraits< uint8 >
struct  CTraits< unsigned char >
class  CTriangle
class  CTriangleColor
class  CTriangleColorUV
class  CTriangleUV
class  CUnfairMutex
class  CUnfairSynchronized
class  CUnfairSynchronized::CAccessor
struct  CUnsensitiveStrLessPred
class  CUpdateThread
class  CUV
class  CUVW
class  CValueSmoother
class  CValueSmootherTemplate
class  CValueSmootherTemplate< bool >
class  CVariable
class  CVariable< std::string >
class  CVariablePtr
class  CVector
class  CVector2d
class  CVector2f
class  CVectorD
class  CVectorH
class  CVectorSString
class  CWindowDisplayer
struct  CWindowDisplayer::CLabelEntry
class  CWordsDictionary
struct  EAllocationFailure
struct  EBadSize
struct  EBadType
struct  EConfigFile
struct  EDDSBadHeader
struct  EFatalError
struct  EFile
struct  EFileNotFound
struct  EFileNotOpened
struct  EInputDevice
struct  EInvalidDataStream
struct  EMemStream
 Exception class for CMemStream. More...

struct  EmitterEqualPred
struct  ENewerStream
struct  EOlderStream
struct  EParseError
struct  EPathNotFound
 Exception throwed when a find is not found in a lookup() call. More...

struct  EReadError
struct  EReallocationFailed
struct  ERegisteredClass
struct  ERegistry
struct  ERenameError
struct  ESeekFailed
struct  ESeekNotSupported
struct  EStream
struct  EStreamOverflow
 This exception is raised when someone tries to serialize in more than there is. More...

struct  EThread
class  ETrapDebug
struct  EUnknownVar
struct  EUnregisteredClass
struct  EWriteError
class  Exception
struct  EXmlParsingError
class  IClassable
class  ICommand
class  IDisplayer
class  IEventEmitter
class  IEventListener
struct  IGameDevice
struct  IInputDevice
struct  IInputDeviceEvent
struct  IInputDeviceManager
struct  IKeyboardDevice
struct  IMouseDevice
 An interface to a low level mouse device. More...

class  IProcess
class  IProgressCallback
class  IProgressCallback::CCropedValues
class  IRunnable
class  IRunnablePos
class  IStream
class  IStreamable
class  IThread
class  IVariable
struct  TBMSDbgInfoData
struct  TBMSSerialInfo

Configuration

typedef CFastMutex CAllocatorMutex

Quaternions functions.

template<class T> CQuatT< T > operator * (T f, const CQuatT< T > &o)
 f*quat operator


Typedefs

typedef std::multimap< CClassId,
IEventListener * > 
mapListener
typedef void *(* memcpyPtr )(void *dts, const void *src, size_t nbytes)
typedef std::vector< TBMSSerialInfoTBMSSerialInfoList
typedef std::map< float, CConcavePolygonsVertexDescTCConcavePolygonsVertexMap
typedef sint64 TCPUCycle
typedef std::string(* TCrashCallback )()
typedef std::vector< CGameDeviceDescTDeviceDescVect
typedef bool(* TEmailFunction )(const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile="", bool onlyCheck=false)
typedef uint32 TGameCycle
typedef double TGameTime
 New time types.

typedef std::map< std::string,
CLeak
TLinkMap
typedef double TLocalTime
typedef uint32 TMsDuration
typedef key_t TSharedMemId
typedef uint TSStringId
typedef uint TStringId
typedef uint32 TTickDuration
typedef sint64 TTicks
typedef sint64 TTime
 Old time type.


Enumerations

enum  TKey {
  Key0 = '0', Key1 = '1', Key2 = '2', Key3 = '3',
  Key4 = '4', Key5 = '5', Key6 = '6', Key7 = '7',
  Key8 = '8', Key9 = '9', KeyA = 'A', KeyB = 'B',
  KeyC = 'C', KeyD = 'D', KeyE = 'E', KeyF = 'F',
  KeyG = 'G', KeyH = 'H', KeyI = 'I', KeyJ = 'J',
  KeyK = 'K', KeyL = 'L', KeyM = 'M', KeyN = 'N',
  KeyO = 'O', KeyP = 'P', KeyQ = 'Q', KeyR = 'R',
  KeyS = 'S', KeyT = 'T', KeyU = 'U', KeyV = 'V',
  KeyW = 'W', KeyX = 'X', KeyY = 'Y', KeyZ = 'Z',
  KeyLBUTTON = 0x01, KeyRBUTTON = 0x02, KeyCANCEL = 0x03, KeyMBUTTON = 0x04,
  KeyBACK = 0x08, KeyTAB = 0x09, KeyCLEAR = 0x0C, KeyRETURN = 0x0D,
  KeySHIFT = 0x10, KeyCONTROL = 0x11, KeyMENU = 0x12, KeyPAUSE = 0x13,
  KeyCAPITAL = 0x14, KeyKANA = 0x15, KeyHANGEUL = 0x15, KeyHANGUL = 0x15,
  KeyJUNJA = 0x17, KeyFINAL = 0x18, KeyHANJA = 0x19, KeyKANJI = 0x19,
  KeyESCAPE = 0x1B, KeyCONVERT = 0x1C, KeyNONCONVERT = 0x1D, KeyACCEPT = 0x1E,
  KeyMODECHANGE = 0x1F, KeySPACE = 0x20, KeyPRIOR = 0x21, KeyNEXT = 0x22,
  KeyEND = 0x23, KeyHOME = 0x24, KeyLEFT = 0x25, KeyUP = 0x26,
  KeyRIGHT = 0x27, KeyDOWN = 0x28, KeySELECT = 0x29, KeyPRINT = 0x2A,
  KeyEXECUTE = 0x2B, KeySNAPSHOT = 0x2C, KeyINSERT = 0x2D, KeyDELETE = 0x2E,
  KeyHELP = 0x2F, KeyLWIN = 0x5B, KeyRWIN = 0x5C, KeyAPPS = 0x5D,
  KeyNUMPAD0 = 0x60, KeyNUMPAD1 = 0x61, KeyNUMPAD2 = 0x62, KeyNUMPAD3 = 0x63,
  KeyNUMPAD4 = 0x64, KeyNUMPAD5 = 0x65, KeyNUMPAD6 = 0x66, KeyNUMPAD7 = 0x67,
  KeyNUMPAD8 = 0x68, KeyNUMPAD9 = 0x69, KeyMULTIPLY = 0x6A, KeyADD = 0x6B,
  KeySEPARATOR = 0x6C, KeySUBTRACT = 0x6D, KeyDECIMAL = 0x6E, KeyDIVIDE = 0x6F,
  KeyF1 = 0x70, KeyF2 = 0x71, KeyF3 = 0x72, KeyF4 = 0x73,
  KeyF5 = 0x74, KeyF6 = 0x75, KeyF7 = 0x76, KeyF8 = 0x77,
  KeyF9 = 0x78, KeyF10 = 0x79, KeyF11 = 0x7A, KeyF12 = 0x7B,
  KeyF13 = 0x7C, KeyF14 = 0x7D, KeyF15 = 0x7E, KeyF16 = 0x7F,
  KeyF17 = 0x80, KeyF18 = 0x81, KeyF19 = 0x82, KeyF20 = 0x83,
  KeyF21 = 0x84, KeyF22 = 0x85, KeyF23 = 0x86, KeyF24 = 0x87,
  KeyNUMLOCK = 0x90, KeySCROLL = 0x91, KeyLSHIFT = 0xA0, KeyRSHIFT = 0xA1,
  KeyLCONTROL = 0xA2, KeyRCONTROL = 0xA3, KeyLMENU = 0xA4, KeyRMENU = 0xA5,
  KeySEMICOLON = 0xBA, KeyEQUALS = 0xBB, KeyCOMMA = 0xBC, KeyDASH = 0xBD,
  KeyPERIOD = 0xBE, KeySLASH = 0xBF, KeyTILDE = 0xC0, KeyLBRACKET = 0xDB,
  KeyBACKSLASH = 0xDC, KeyRBRACKET = 0xDD, KeyAPOSTROPHE = 0xDE, KeyPROCESSKEY = 0xE5,
  KeyATTN = 0xF6, KeyCRSEL = 0xF7, KeyEXSEL = 0xF8, KeyEREOF = 0xF9,
  KeyPLAY = 0xFA, KeyZOOM = 0xFB, KeyNONAME = 0xFC, KeyPA1 = 0xFD,
  KeyOEM_CLEAR = 0xFE, KeyCount = 0xFF
}
enum  TKeyButton { noKeyButton = 0x0, ctrlKeyButton = 0x8, shiftKeyButton = 0x10, altKeyButton = 0x20 }
enum  TMouseButton {
  noButton = 0x0, leftButton = 0x1, middleButton = 0x2, rightButton = 0x4,
  ctrlButton = 0x8, shiftButton = 0x10, altButton = 0x20
}
enum  TReportResult { ReportDebug, ReportIgnore, ReportQuit, ReportError }

Functions

string addSlashR (string str)
int atoihex (const char *ident)
sint64 atoiInt64 (const char *ident, sint64 base)
 Convert a string into an sint64 (same as atoi() function but for 64 bits intergers).

uint32 atoui (const char *ident)
void beep (uint freq, uint duration)
uint32 blend (uint32 &n0, uint32 &n1, uint32 coef0)
void blendFromui (NLMISC::CRGBA &c0, NLMISC::CRGBA &c1, uint coef)
void BuildHermiteVector (const NLMISC::CVector2f &P0, const NLMISC::CVector2f &P1, const NLMISC::CVector2f &T0, const NLMISC::CVector2f &T1, NLMISC::CVector2f &dest, float lambda)
 build some hermite spline value, with the given points and tangents

string bytesToHumanReadable (uint32 bytes)
string bytesToHumanReadable (const std::string &bytes)
 Convert a number in bytes into a string that is easily readable by an human, for example 105123 -> "102kb".

void cbInvalidEntityNamesFilename (const std::string &invalidEntityNamesFilename)
void cbVarChanged (CConfigFile::CVar &cvar)
void changeLogDirectory (const std::string &dir)
void CHeapAllocatorOutputError (const char *str)
template<class T, class U, class V> void clamp (T &v, const U &min, const V &max)
template<class T, class U> T computeBilinear (const T &v0, const T &v1, const T &v2, const T &v3, const U &s, const U &t)
template<class T> void contReset (T &a)
bool CopyMoveFile (const char *dest, const char *src, bool copyFile, bool failIfExists=false)
void createDebug (const char *logPath, bool logInFile)
float degToRad (float deg)
bool DetectMMX (void)
bool DetectSSE (void)
void displayBitStream (const CBitMemStream &msg, sint beginbitpos, sint endbitpos, NLMISC::CLog *log)
 Display a part of a bitmemstream.

void displayByteBits (uint8 b, uint nbits, sint beginpos, bool displayBegin, NLMISC::CLog *log)
 Display the bits (with 0 and 1) composing a byte (from right to left).

void displayCallStack (CLog *log)
void displayDwordBits (uint32 b, uint nbits, sint beginpos, bool displayBegin, NLMISC::CLog *log)
 Display the bits (with 0 and 1) composing a number (uint32) (from right to left).

void drawFullLine (float x0, float y0, float x1, float y1, std::vector< std::pair< sint, sint > > &result)
void drawLine (float x0, float y0, float x1, float y1, std::vector< std::pair< sint, sint > > &result)
void drawLine (float x0, float y0, float x1, float y1, vector< pair< sint, sint > > &result)
void enterBreakpoint (const char *message)
void explode (const std::string &src, const std::string &sep, std::vector< std::string > &res, bool skipEmpty)
void fastClamp8 (sint &v)
memcpyPtr findBestmemcpy ()
void fprintf_int (uint value)
float frand (float mod)
uint32 fromHumanReadable (const std::string &str)
 Get a bytes or time in string format and convert it in seconds or bytes.

void fromString (const std::string &str, std::string &val)
void fromString (const std::string &str, bool &val)
void fromString (const std::string &str, double &val)
void fromString (const std::string &str, float &val)
void fromString (const std::string &str, sint64 &val)
void fromString (const std::string &str, uint64 &val)
void fromString (const std::string &str, sint16 &val)
void fromString (const std::string &str, uint16 &val)
void fromString (const std::string &str, sint8 &val)
void fromString (const std::string &str, uint8 &val)
void fromString (const std::string &str, sint32 &val)
void fromString (const std::string &str, uint32 &val)
sint fsgn (double f)
void getCallStackAndLog (string &result, sint skipNFirst)
 Get the call stack and set it with result.

string getname (dirent *de)
uint getPowerOf2 (uint v)
uint getThreadId ()
 Returns Process Id (note: on Linux, Process Id is the same as the Thread Id) Returns Thread Id (note: on Linux, Process Id is the same as the Thread Id).

float HLSValue (float h, float v1, float v2)
 Used by buildFromHLS.

uint32 humanReadableToBytes (const std::string &str)
 Convert a human readable into a bytes, for example "102kb" -> 105123.

uint32 humanReadableToBytes (const string &str)
void initDebug2 (bool logInFile)
bool isdirectory (dirent *de)
bool isfile (dirent *de)
bool isPowerOf2 (sint32 v)
double isValidDouble (double v)
void itoaInt64 (sint64 number, char *str, sint64 base)
 Convert an sint64 into a string (same as itoa() function but for 64 bits intergers).

CStringConversion< TKeyKeyConversion (stringTable, sizeof(stringTable)/sizeof(stringTable[0]), KeyCount)
bool killProgram (uint32 pid)
 This function kill a program using his pid (on unix, it uses the kill() POSIX function).

bool launchProgram (const std::string &programName, const std::string &arguments)
template<class T> T maxof (const T &a, const T &b, const T &c, const T &d, const T &e)
template<class T> T maxof (const T &a, const T &b, const T &c, const T &d)
template<class T> T maxof (const T &a, const T &b, const T &c)
template<class T> T minof (const T &a, const T &b, const T &c, const T &d, const T &e)
template<class T> T minof (const T &a, const T &b, const T &c, const T &d)
template<class T> T minof (const T &a, const T &b, const T &c)
CPolygon2D::TVec2fVect::const_iterator Next (const CPolygon2D::TVec2fVect::const_iterator &it, const CPolygon2D::TVec2fVect &cont)
 NL_TRIVIAL_TYPE_TRAITS (NL3D::CPlaneBasis)
void nlError (const char *format,...)
 Never use this function but call the nlerror macro (internal use only).

void nlFatalError (const char *format,...)
 Never use this function (internal use only).

int nlfseek64 (FILE *stream, sint64 offset, int origin)
 NLMISC_COMMAND (displayMeasures,"display hierarchical timer","[depth]")
 NLMISC_COMMAND (playerInfo,"Get informations about a player or all players in CEntityIdTranslator","[< entityname >|< eid >|< username >|< uid >]")
 NLMISC_COMMAND (entityNameValid,"Tell if an entity name is valid or not using CEntityIdTranslator validation rulez","< entityname >")
 NLMISC_COMMAND (findEIdByEntity,"Find entity id using the entity name","< entityname >|< eid >")
 NLMISC_COMMAND (findEIdByUser,"Find entity ids using the user name","< username >|< uid >")
 NLMISC_COMMAND (readaccess,"read a uint8 value in an invalid address","[< adr >]")
 NLMISC_COMMAND (writeaccess,"write a uint8 value in an invalid address","[< adr >[< value >]]")
 NLMISC_COMMAND (divbyzero,"generate a divide by zero","")
 NLMISC_COMMAND (abort,"generate a abort()","")
 NLMISC_COMMAND (stop,"generate a nlstop()","")
 NLMISC_COMMAND (assert,"generate a failed nlassert()","")
 NLMISC_COMMAND (displayFilterWarning,"display filter on WarningLog","")
 NLMISC_COMMAND (removeFilterWarning,"remove a filter on WarningLog","[< filterstr >]")
 NLMISC_COMMAND (addNegativeFilterWarning,"add a negative filter on WarningLog","< filterstr >")
 NLMISC_COMMAND (addPositiveFilterWarning,"add a positive filter on WarningLog","< filterstr >")
 NLMISC_COMMAND (displayFilterInfo,"display filter on InfoLog","[d|i|w|e]")
 NLMISC_COMMAND (removeFilterInfo,"remove a filter on InfoLog","[< filterstr >]")
 NLMISC_COMMAND (addNegativeFilterInfo,"add a negative filter on InfoLog","< filterstr >")
 NLMISC_COMMAND (addPositiveFilterInfo,"add a positive filter on InfoLog","< filterstr >")
 NLMISC_COMMAND (displayFilterDebug,"display filter on DebugLog","")
 NLMISC_COMMAND (removeFilterDebug,"remove a filter on DebugLog","[< filterstr >]")
 NLMISC_COMMAND (addNegativeFilterDebug,"add a negative filter on DebugLog","< filterstr >")
 NLMISC_COMMAND (addPositiveFilterDebug,"add a positive filter on DebugLog","< filterstr >")
 NLMISC_COMMAND (resetFilters,"disable all filters on Nel loggers","[debug|info|warning|error|assert]")
 NLMISC_COMMAND (displayMemlog,"displays the last N line of the log in memory","[< NbLines >]")
 NLMISC_COMMAND (killProgram,"kill a program given the pid","< pid >")
 NLMISC_COMMAND (launchProgram,"Execute the command line using launcProgram() function call(launch in background task without waiting the end of the execution)","< programName >< arguments >")
 NLMISC_COMMAND (system,"Execute the command line using system() function call(wait until the end of the command)","< commandline >")
 NLMISC_COMMAND (sleep,"Freeze the service for N seconds(for debug purpose)","< N >")
 NLMISC_COMMAND (stohr,"Convert a second number into an human readable time","< int >")
 NLMISC_COMMAND (hrtob,"Convert a human readable number into a bytes number","< hr >")
 NLMISC_COMMAND (btohr,"Convert a bytes number into an human readable number","< int >")
 NLMISC_COMMAND (help,"display help on a specific variable/commands or on all variables and commands","[< variable >|< command >]")
 NLMISC_DYNVARIABLE (string, OS,"OS used")
 NLMISC_DYNVARIABLE (string, ProcessUsedMemory,"Memory used by this process in bytes")
 NLMISC_DYNVARIABLE (string, TotalPhysicalMemory,"Total physical memory on this computer in bytes")
 NLMISC_DYNVARIABLE (string, AvailablePhysicalMemory,"Physical memory available on this computer in bytes")
void nlSleep (uint32 ms)
sint nlstricmp (const char *lhs, const std::string &rhs)
sint nlstricmp (const std::string &lhs, const char *rhs)
sint nlstricmp (const std::string &lhs, const std::string &rhs)
sint nlstricmp (const char *lhs, const char *rhs)
CVectorD operator * (double f, const CVectorD &v)
CVector operator * (float f, const CVector &v)
CVector2f operator * (float f, const CVector2f &v)
CVector2d operator * (double f, const CVector2d &v)
CUV operator * (const CUV &uv, float f)
CUV operator * (float f, const CUV &uv)
CRGBAF operator * (float f, const CRGBAF &c)
CPlane operator * (const CPlane &p, const CMatrix &m)
bool operator!= (const CGameDeviceDesc &lhs, const CGameDeviceDesc &rhs)
bool operator< (const CVector2f &lhs, const CVector2f &rhs)
bool operator< (const CPolygon2D &lhs, const CPolygon2D &rhs)
bool operator== (const CGameDeviceDesc &lhs, const CGameDeviceDesc &rhs)
 for devices comparison. The 'Connected' field is ignored.

bool operator== (const CPolygon2D &lhs, const CPolygon2D &rhs)
sint OptFastFloor (float x)
uint32 OptFastFloor24 (float x)
void OptFastFloorBegin ()
void OptFastFloorBegin24 ()
void OptFastFloorEnd ()
void OptFastFloorEnd24 ()
float OptFastFractionnalPart (float x)
CPolygon2D::TVec2fVect::const_iterator Prev (const CPolygon2D::TVec2fVect::const_iterator &it, const CPolygon2D::TVec2fVect &cont)
float radToDeg (float rad)
uint raiseToNextPowerOf2 (uint v)
void removeAllUnusedChar (string &str)
string removeSlashR (string str)
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime)
void report ()
template<class T> void rotateCCW (const T *src, T *dst, uint srcWidth, uint srcHeight)
template<class T, class U> T safe_cast (U o)
void ScanEdge (CPolygon2D::TRasterVect &outputVect, sint topY, const CVector2f &v1, const CVector2f &v2, bool rightEdge=true)
 ***************************************************************************************

void ScanInnerEdge (CPolygon2D::TRaster *r, float x1, float y1, float x2, float y2, sint minY, bool rightEdge)
void ScanOuterEdgeLeft (CPolygon2D::TRaster *r, float x1, float y1, float x2, float y2, sint minY)
void ScanOuterEdgeRight (CPolygon2D::TRaster *r, float x1, float y1, float x2, float y2, sint minY)
template<class T> uint searchLowerBound (const std::vector< T > &array, const T &key)
template<class T> uint searchLowerBound (const T *array, uint arraySize, const T &key)
string secondsToHumanReadable (uint32 time)
 Convert a time into a string that is easily readable by an human, for example 3600 -> "1h".

void setAssert (bool assert)
void setCrashCallback (TCrashCallback crashCallback)
void setReportEmailFunction (void *emailFunction)
char * skipToken (const char *p)
char * skipWS (const char *p)
sint smprintf (char *buffer, size_t count, const char *format,...)
void splitString (const std::string &str, const std::string &separator, std::vector< std::string > &retList)
template<class T> T sqr (const T &v)
template<class T, class U> bool strFindReplace (T &str, const char *strFind, const U &strReplace)
template<class T, class U> bool strFindReplace (T &str, const T &strFind, const U &strReplace)
 In a string or ucstring, find a substr and replace it with an other. return true if replaced.

int stricmp (const char *lhs, const char *rhs)
std::string stringFromVector (const std::vector< uint8 > &v, bool limited=true)
 Returns a readable string from a vector of bytes. unprintable char are replaced by '?'.

string stringFromVector (const vector< uint8 > &v, bool limited)
char * strlwr (char *str)
std::string & strlwr (std::string &str)
std::string strlwr (const std::string &str)
char * strupr (char *str)
std::string strupr (const std::string &str)
std::string & strupr (std::string &str)
bool testWildCard (const char *strIn, const char *wildCard)
bool testWildCard (const std::string &strIn, const std::string &wildCard)
std::string toString (const std::string &val)
std::string toString (const bool &val)
std::string toString (const double &val)
std::string toString (const float &val)
std::string toString (const sint64 &val)
std::string toString (const uint64 &val)
std::string toString (const sint32 &val)
std::string toString (const uint32 &val)
std::string toString (const sint16 &val)
std::string toString (const uint16 &val)
std::string toString (const sint8 &val)
std::string toString (const uint8 &val)
template<class T> std::string toString (const T &obj)
std::string toString (const char *format,...)
std::string toString (NL3D::CPSEmitter::TEmissionType type)
template<class T> std::string toStringEnum (const T &val)
template<class T> std::string toStringPtr (const T *val)
template<class T, class U> T type_cast (U o)
void xmlGenericErrorFuncRead (void *ctx, const char *msg,...)
void xmlGenericErrorFuncWrite (void *ctx, const char *msg,...)
int xmlOutputCloseCallbackForNeL (void *context)
int xmlOutputWriteCallbackForNeL (void *context, const char *buffer, int len)

Variables

CLogAssertLog = NULL
string BasePathgetPathContent
const uint32 BF_ALWAYS_OPENED = 0x00000001
const uint32 BF_CACHE_FILE_ON_OPEN = 0x00000002
TCrashCallback CrashCallback = NULL
const uint32 DDS = ((uint32)(uint8)( 'D' ) | ((uint32)(uint8)( 'D' ) << 8) | ((uint32)(uint8)( 'S' ) << 16) | ((uint32)(uint8)( ) << 24 ))
CLogDebugLog = NULL
bool DebugNeedAssert = false
CMemDisplayerDefaultMemDisplayer = NULL
CMsgBoxDisplayerDefaultMsgBoxDisplayer = NULL
const uint32 DXT_ = ((uint32)(uint8)( 'D' ) | ((uint32)(uint8)( 'X' ) << 8) | ((uint32)(uint8)( 'T' ) << 16) | ((uint32)(uint8)( '\0' ) << 24 ))
TEmailFunction EmailFunction = NULL
CLogErrorLog = NULL
const CClassId EventActivateId (0x7da66b0a, 0x1ef74519)
const CClassId EventCharId (0x552255fe, 0x75a2373f)
const CClassId EventDestroyWindowId (0x69be73fe, 0x4b07603b)
const CClassId EventGDAxisMovedId (0x073306, 0x41173626)
const CClassId EventGDButtonDownId (0x57141957, 0x3efb143a)
const CClassId EventGDButtonUpId (0x16105e06, 0x302536b2)
const CClassId EventGDMouseMove (0x12142bc4, 0x43c73e74)
const CClassId EventGDPOVChanged (0x362851b9, 0x395c4d61)
const CClassId EventGDSliderMovedId (0x68776586, 0x394a6916)
const CClassId EventKeyDownId (0x3c2643da, 0x43f802a1)
const CClassId EventKeyUpId (0x1e62e85, 0x68a35d46)
const CClassId EventMouseDblClkId (0x55a94cb3, 0x3e641517)
const CClassId EventMouseDownId (0x35b7878, 0x5d4a0f86)
const CClassId EventMouseMoveId (0x3dd12fdb, 0x472f548b)
const CClassId EventMouseUpId (0xcce1f7e, 0x7ed344d7)
const CClassId EventMouseWheelId (0x73ac4321, 0x4c273150)
const CClassId EventSetFocusId (0x17650fac, 0x19f85dde)
CFileDisplayerfd = NULL
vector< CFileEntryFileToCheck
bool GlobalAssertCall = false
bool HasMMX = DetectMMX()
bool HasSSE = DetectSSE()
CLogInfoLog = NULL
char JPGBuffer [JPGBufferSize]
const uint32 JPGBufferSize = 1000
NLMISC::IStreamJPGStream = NULL
const char * LogTypeToString [][8]
const uint8 MAX_MIPMAP = 16
const int MaxCStringSize = 1024*2
bool NL3D_BlockMemoryAssertOnPurge = true
 See CBlockMemory::Purge.

const float NL3D_OO255 = 1.0f / 255
CRandomGrid3D NL3D_RandomGrid3D
bool NoAssert = false
int OptFastFloorBkupCW
int OptFastFloorBkupCW24
double OptFastFloorMagicConst = pow(2,52) + pow(2,51)
float OptFastFloorMagicConst24 = (float)pow(2,23)
const double Pi = 3.1415926535897932384626433832795
const double QuatEpsilon = 0.000001
CStdDisplayersd = NULL
const int SEP_SIZE = 1
const char SEPARATOR = ' '
const char * SerialTypeToCStr [TBMSSerialInfo::NbSerialTypes] = { "Bool ", "Ui32N", "Ui64N", "Float", "Btfld", "Buffr" }
map< TSharedMemId, int > SharedMemIdsToShmids
const CStringConversion< TKey
>::CPair 
stringTable []
CLogWarningLog = NULL


Typedef Documentation

typedef CFastMutex NLMISC::CAllocatorMutex
 

Definition at line 56 of file include/nel/misc/heap_allocator.h.

typedef std::multimap<CClassId, IEventListener*> NLMISC::mapListener
 

Definition at line 43 of file event_server.h.

typedef void*(* NLMISC::memcpyPtr)(void *dts, const void *src, size_t nbytes)
 

Definition at line 225 of file fast_mem.cpp.

Referenced by findBestmemcpy().

typedef std::vector< TBMSSerialInfo > NLMISC::TBMSSerialInfoList
 

Definition at line 153 of file bit_mem_stream.h.

typedef std::map<float, CConcavePolygonsVertexDesc> NLMISC::TCConcavePolygonsVertexMap
 

Definition at line 173 of file polygon.cpp.

Referenced by NLMISC::CPolygon::toConvexPolygonsLocalAndBSP().

typedef sint64 NLMISC::TCPUCycle
 

Definition at line 44 of file time_nl.h.

typedef std::string(* NLMISC::TCrashCallback)()
 

Definition at line 75 of file debug.h.

Referenced by setCrashCallback().

typedef std::vector<CGameDeviceDesc> NLMISC::TDeviceDescVect
 

Definition at line 52 of file game_device.h.

typedef bool(* NLMISC::TEmailFunction)(const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile = "", bool onlyCheck = false)
 

Definition at line 61 of file report.cpp.

Referenced by setReportEmailFunction().

typedef uint32 NLMISC::TGameCycle
 

Definition at line 42 of file time_nl.h.

typedef double NLMISC::TGameTime
 

New time types.

Definition at line 41 of file time_nl.h.

typedef std::map<std::string, CLeak> NLMISC::TLinkMap
 

Definition at line 1914 of file misc/heap_allocator.cpp.

Referenced by NLMISC::CHeapAllocator::debugReportMemoryLeak().

typedef double NLMISC::TLocalTime
 

Definition at line 43 of file time_nl.h.

typedef uint32 NLMISC::TMsDuration
 

Definition at line 38 of file stop_watch.h.

Referenced by NLMISC::CStopWatch::getAverageDuration(), NLMISC::CStopWatch::getDuration(), and NLMISC::CStopWatch::getPartialAverage().

typedef key_t NLMISC::TSharedMemId
 

Definition at line 41 of file shared_memory.h.

Referenced by NLMISC::CSharedMemory::accessSharedMemory(), NLMISC::CSharedMemory::createSharedMemory(), and NLMISC::CSharedMemory::destroySharedMemory().

typedef uint NLMISC::TSStringId
 

Definition at line 104 of file string_mapper.h.

Referenced by NLMISC::CStaticStringMapper::add(), NLMISC::CStaticStringMapper::emptyId(), NLMISC::CStaticStringMapper::get(), NLMISC::CStaticStringMapper::memoryUncompress(), and NLMISC::CStaticStringMapper::serial().

typedef uint NLMISC::TStringId
 

Definition at line 42 of file string_mapper.h.

typedef uint32 NLMISC::TTickDuration
 

Definition at line 37 of file stop_watch.h.

Referenced by NLMISC::CStopWatch::addMeasurement(), NLMISC::CStopWatch::addTime(), NLMISC::CStopWatch::pause(), NLMISC::CStopWatch::stop(), and NLMISC::CStopWatch::sumTicks().

typedef sint64 NLMISC::TTicks
 

Definition at line 48 of file time_nl.h.

Referenced by NL3D::CDriverGL::appendVBHardLockProfile(), NLPACS::CGlobalRetriever::findAStarPath(), NLPACS::CGlobalRetriever::findPath(), NLMISC::CBufFIFO::front(), NLMISC::CTime::getPerformanceTime(), NLSOUND::CSimpleSource::getPlayTime(), NLMISC::CSystemInfo::getProcessorFrequency(), NL3D::CVertexBufferHardGLNVidia::lock(), NLMISC::CBufFIFO::push(), NLMISC::CBufFIFO::resize(), NLAIAGENT::CAgentScript::run(), NLAIAGENT::CAgentClockTimer::runActivity(), NLAIAGENT::CAgentWatchTimer::runActivity(), NLMISC::CTime::ticksToSecond(), and NLSOUND::CSoundDriverDSound::update().

typedef sint64 NLMISC::TTime
 

Old time type.

Definition at line 47 of file time_nl.h.

Referenced by NLSOUND::CAudioMixerUser::addEvent(), NLNET::CCallbackNetBase::baseUpdate(), NLNET::cbServerAskUniversalTime(), NLNET::CUdpSimSock::dataAvailable(), NLMISC::CTime::getLocalTime(), NLNET::_CUniTime::getStringUniTime(), NLSOUND::CComplexSource::getTime(), NLNET::_CUniTime::getUniTime(), loadForm(), NLNET::IService::main(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CComplexSource::playStuf(), NLAIAGENT::CAgentManagerTimer::CRunTimer::run(), NLNET::CUdpSimSock::sendUDP(), NLNET::_CUniTime::setUniTime(), NLNET::IService::setUpdateTimeout(), NLMISC::CTime::ticksToSecond(), NLSOUND::CSoundDriverDSound::TimerCallback(), NLNET::CUnifiedNetwork::update(), NLSOUND::CSoundDriverDSound::update(), NLNET::CNetManager::update(), NLNET::CBufSock::update(), and NLNET::CUdpSimSock::updateBufferizedPackets().


Enumeration Type Documentation

enum NLMISC::TKey
 

Enumeration values:
Key0 
Key1 
Key2 
Key3 
Key4 
Key5 
Key6 
Key7 
Key8 
Key9 
KeyA 
KeyB 
KeyC 
KeyD 
KeyE 
KeyF 
KeyG 
KeyH 
KeyI 
KeyJ 
KeyK 
KeyL 
KeyM 
KeyN 
KeyO 
KeyP 
KeyQ 
KeyR 
KeyS 
KeyT 
KeyU 
KeyV 
KeyW 
KeyX 
KeyY 
KeyZ 
KeyLBUTTON 
KeyRBUTTON 
KeyCANCEL 
KeyMBUTTON 
KeyBACK 
KeyTAB 
KeyCLEAR 
KeyRETURN 
KeySHIFT 
KeyCONTROL 
KeyMENU 
KeyPAUSE 
KeyCAPITAL 
KeyKANA 
KeyHANGEUL 
KeyHANGUL 
KeyJUNJA 
KeyFINAL 
KeyHANJA 
KeyKANJI 
KeyESCAPE 
KeyCONVERT 
KeyNONCONVERT 
KeyACCEPT 
KeyMODECHANGE 
KeySPACE 
KeyPRIOR 
KeyNEXT 
KeyEND 
KeyHOME 
KeyLEFT 
KeyUP 
KeyRIGHT 
KeyDOWN 
KeySELECT 
KeyPRINT 
KeyEXECUTE 
KeySNAPSHOT 
KeyINSERT 
KeyDELETE 
KeyHELP 
KeyLWIN 
KeyRWIN 
KeyAPPS 
KeyNUMPAD0 
KeyNUMPAD1 
KeyNUMPAD2 
KeyNUMPAD3 
KeyNUMPAD4 
KeyNUMPAD5 
KeyNUMPAD6 
KeyNUMPAD7 
KeyNUMPAD8 
KeyNUMPAD9 
KeyMULTIPLY 
KeyADD 
KeySEPARATOR 
KeySUBTRACT 
KeyDECIMAL 
KeyDIVIDE 
KeyF1 
KeyF2 
KeyF3 
KeyF4 
KeyF5 
KeyF6 
KeyF7 
KeyF8 
KeyF9 
KeyF10 
KeyF11 
KeyF12 
KeyF13 
KeyF14 
KeyF15 
KeyF16 
KeyF17 
KeyF18 
KeyF19 
KeyF20 
KeyF21 
KeyF22 
KeyF23 
KeyF24 
KeyNUMLOCK 
KeySCROLL 
KeyLSHIFT 
KeyRSHIFT 
KeyLCONTROL 
KeyRCONTROL 
KeyLMENU 
KeyRMENU 
KeySEMICOLON 
KeyEQUALS 
KeyCOMMA 
KeyDASH 
KeyPERIOD 
KeySLASH 
KeyTILDE 
KeyLBRACKET 
KeyBACKSLASH 
KeyRBRACKET 
KeyAPOSTROPHE 
KeyPROCESSKEY 
KeyATTN 
KeyCRSEL 
KeyEXSEL 
KeyEREOF 
KeyPLAY 
KeyZOOM 
KeyNONAME 
KeyPA1 
KeyOEM_CLEAR 
KeyCount 

Definition at line 81 of file events.h.

Referenced by NLMISC::CEventKey::getKeyFromString().

00082 {
00083         Key0                            ='0',
00084         Key1                            ='1',
00085         Key2                            ='2',
00086         Key3                            ='3',
00087         Key4                            ='4',
00088         Key5                            ='5',
00089         Key6                            ='6',
00090         Key7                            ='7',
00091         Key8                            ='8',
00092         Key9                            ='9',
00093         KeyA                            ='A',
00094         KeyB                            ='B',
00095         KeyC                            ='C',
00096         KeyD                            ='D',
00097         KeyE                            ='E',
00098         KeyF                            ='F',
00099         KeyG                            ='G',
00100         KeyH                            ='H',
00101         KeyI                            ='I',
00102         KeyJ                            ='J',
00103         KeyK                            ='K',
00104         KeyL                            ='L',
00105         KeyM                            ='M',
00106         KeyN                            ='N',
00107         KeyO                            ='O',
00108         KeyP                            ='P',
00109         KeyQ                            ='Q',
00110         KeyR                            ='R',
00111         KeyS                            ='S',
00112         KeyT                            ='T',
00113         KeyU                            ='U',
00114         KeyV                            ='V',
00115         KeyW                            ='W',
00116         KeyX                            ='X',
00117         KeyY                            ='Y',
00118         KeyZ                            ='Z',
00119         KeyLBUTTON        =0x01,
00120         KeyRBUTTON        =0x02,
00121         KeyCANCEL         =0x03,
00122         KeyMBUTTON        =0x04,
00123         KeyBACK           =0x08,
00124         KeyTAB            =0x09,
00125         KeyCLEAR          =0x0C,
00126         KeyRETURN         =0x0D,
00127         KeySHIFT          =0x10,
00128         KeyCONTROL        =0x11,
00129         KeyMENU           =0x12,
00130         KeyPAUSE          =0x13,
00131         KeyCAPITAL        =0x14,
00132         KeyKANA           =0x15,
00133         KeyHANGEUL        =0x15,
00134         KeyHANGUL         =0x15,
00135         KeyJUNJA          =0x17,
00136         KeyFINAL          =0x18,
00137         KeyHANJA          =0x19,
00138         KeyKANJI          =0x19,
00139         KeyESCAPE         =0x1B,
00140         KeyCONVERT        =0x1C,
00141         KeyNONCONVERT     =0x1D,
00142         KeyACCEPT         =0x1E,
00143         KeyMODECHANGE     =0x1F,
00144         KeySPACE          =0x20,
00145         KeyPRIOR          =0x21,
00146         KeyNEXT           =0x22,
00147         KeyEND            =0x23,
00148         KeyHOME           =0x24,
00149         KeyLEFT           =0x25,
00150         KeyUP             =0x26,
00151         KeyRIGHT          =0x27,
00152         KeyDOWN           =0x28,
00153         KeySELECT         =0x29,
00154         KeyPRINT          =0x2A,
00155         KeyEXECUTE        =0x2B,
00156         KeySNAPSHOT       =0x2C,
00157         KeyINSERT         =0x2D,
00158         KeyDELETE         =0x2E,
00159         KeyHELP           =0x2F,
00160         KeyLWIN           =0x5B,
00161         KeyRWIN           =0x5C,
00162         KeyAPPS           =0x5D,
00163         KeyNUMPAD0        =0x60,
00164         KeyNUMPAD1        =0x61,
00165         KeyNUMPAD2        =0x62,
00166         KeyNUMPAD3        =0x63,
00167         KeyNUMPAD4        =0x64,
00168         KeyNUMPAD5        =0x65,
00169         KeyNUMPAD6        =0x66,
00170         KeyNUMPAD7        =0x67,
00171         KeyNUMPAD8        =0x68,
00172         KeyNUMPAD9        =0x69,
00173         KeyMULTIPLY       =0x6A,
00174         KeyADD            =0x6B,
00175         KeySEPARATOR      =0x6C,
00176         KeySUBTRACT       =0x6D,
00177         KeyDECIMAL        =0x6E,
00178         KeyDIVIDE         =0x6F,
00179         KeyF1             =0x70,
00180         KeyF2             =0x71,
00181         KeyF3             =0x72,
00182         KeyF4             =0x73,
00183         KeyF5             =0x74,
00184         KeyF6             =0x75,
00185         KeyF7             =0x76,
00186         KeyF8             =0x77,
00187         KeyF9             =0x78,
00188         KeyF10            =0x79,
00189         KeyF11            =0x7A,
00190         KeyF12            =0x7B,
00191         KeyF13            =0x7C,
00192         KeyF14            =0x7D,
00193         KeyF15            =0x7E,
00194         KeyF16            =0x7F,
00195         KeyF17            =0x80,
00196         KeyF18            =0x81,
00197         KeyF19            =0x82,
00198         KeyF20            =0x83,
00199         KeyF21            =0x84,
00200         KeyF22            =0x85,
00201         KeyF23            =0x86,
00202         KeyF24            =0x87,
00203         KeyNUMLOCK        =0x90,
00204         KeySCROLL         =0x91,
00205         KeyLSHIFT         =0xA0,
00206         KeyRSHIFT         =0xA1,
00207         KeyLCONTROL       =0xA2,
00208         KeyRCONTROL       =0xA3,
00209         KeyLMENU          =0xA4,
00210         KeyRMENU          =0xA5,
00211         KeySEMICOLON      =0xBA,
00212         KeyEQUALS         =0xBB,
00213         KeyCOMMA          =0xBC,
00214         KeyDASH           =0xBD,
00215         KeyPERIOD         =0xBE,
00216         KeySLASH          =0xBF,
00217         KeyTILDE          =0xC0,
00218         KeyLBRACKET       =0xDB,
00219         KeyBACKSLASH      =0xDC,
00220         KeyRBRACKET       =0xDD,
00221         KeyAPOSTROPHE     =0xDE,
00222         KeyPROCESSKEY     =0xE5,
00223         KeyATTN           =0xF6,
00224         KeyCRSEL          =0xF7,
00225         KeyEXSEL          =0xF8,
00226         KeyEREOF          =0xF9,
00227         KeyPLAY           =0xFA,
00228         KeyZOOM           =0xFB,
00229         KeyNONAME         =0xFC,
00230         KeyPA1            =0xFD,
00231         KeyOEM_CLEAR      =0xFE,
00232         KeyCount          =0xFF
00233 };

enum NLMISC::TKeyButton
 

Enumeration values:
noKeyButton 
ctrlKeyButton 
shiftKeyButton 
altKeyButton 

Definition at line 246 of file events.h.

00247 {
00248         noKeyButton                     =0x0,
00249         ctrlKeyButton           =0x8,
00250         shiftKeyButton          =0x10,
00251         altKeyButton            =0x20
00252 };

enum NLMISC::TMouseButton
 

Enumeration values:
noButton 
leftButton 
middleButton 
rightButton 
ctrlButton 
shiftButton 
altButton 

Definition at line 235 of file events.h.

00236 {
00237         noButton                =0x0,
00238         leftButton              =0x1,
00239         middleButton    =0x2,
00240         rightButton             =0x4,
00241         ctrlButton              =0x8,
00242         shiftButton             =0x10,
00243         altButton               =0x20
00244 };

enum NLMISC::TReportResult
 

Display a custom message box.

Parameters:
title set the title of the report. If empty, it'll display "NeL report".
header message displayed before the edit text box. If empty, it displays the default message.
body message displayed in the edit text box. This string will be sent by email.
debugButton 0 for disabling it, 1 for enable with default behaviors (generate a breakpoint), 2 for enable with no behavior
Returns:
the button clicked or error
Enumeration values:
ReportDebug 
ReportIgnore 
ReportQuit 
ReportError 

Definition at line 46 of file report.h.


Function Documentation

std::string NLMISC::addSlashR std::string  str  ) 
 

Definition at line 35 of file string_common.cpp.

References uint.

00036 {
00037         string formatedStr;
00038         // replace \n with \r\n
00039         for (uint i = 0; i < str.size(); i++)
00040         {
00041                 if (str[i] == '\n' && i > 0 && str[i-1] != '\r')
00042                 {
00043                         formatedStr += '\r';
00044                 }
00045                 formatedStr += str[i];
00046         }
00047         return formatedStr;
00048 }

uint32 NLMISC::atoihex const char *  ident  )  [inline]
 

Todo:
cado: NLMISC::CStringStream: Use strtoul() functions instead of atoi(), to handle conversion errors

Definition at line 102 of file string_stream.cpp.

Referenced by NLMISC::CStringStream::serialHex(), and NLMISC::CMemStream::serialHex().

00103 {
00104         int number;
00105         sscanf( ident, "%x", &number );
00106         return number;
00107 }

sint64 NLMISC::atoiInt64 const char *  ident,
sint64  base = 10
 

Convert a string into an sint64 (same as atoi() function but for 64 bits intergers).

old sameh algo

Definition at line 178 of file common.cpp.

References nlassert, and sint64.

Referenced by bytesToHumanReadable().

00179 {
00180         sint64 number = 0;
00181         bool neg = false;
00182 
00183         // NULL string
00184         nlassert (ident != NULL);
00185 
00186         // empty string
00187         if (*ident == '\0') goto end;
00188         
00189         // + sign
00190         if (*ident == '+') ident++;
00191 
00192         // - sign
00193         if (*ident == '-') { neg = true; ident++; }
00194 
00195         while (*ident != '\0')
00196         {
00197                 if (isdigit(*ident))
00198                 {
00199                         number *= base;
00200                         number += (*ident)-'0';
00201                 }
00202                 else if (base > 10 && islower(*ident))
00203                 {
00204                         number *= base;
00205                         number += (*ident)-'a'+10;
00206                 }
00207                 else if (base > 10 && isupper(*ident))
00208                 {
00209                         number *= base;
00210                         number += (*ident)-'A'+10;
00211                 }
00212                 else
00213                 {
00214                         goto end;
00215                 }
00216                 ident++;
00217         }
00218 end:
00219         if (neg) number = -number;
00220         return number;
00221 
00223 /*      uint64 k = 0;
00224 
00225         while (*ident != '\0')
00226         {
00227                 switch(*(ident++))
00228                 {
00229                 case '0':
00230                         k +=0;
00231                         break;
00232                 case '1':
00233                         k +=1;
00234                         break;
00235                 case '2':
00236                         k +=2;
00237                         break;
00238                 case '3':
00239                         k +=3;
00240                         break;
00241                 case '4':
00242                         k +=4;
00243                         break;
00244                 case '5':
00245                         k +=5;
00246                         break;
00247                 case '6':
00248                         k +=6;
00249                         break;
00250                 case '7':
00251                         k +=7;
00252                         break;
00253                 case '8':
00254                         k +=8;
00255                         break;
00256                 case '9':
00257                         k +=9;
00258                         break;
00259                 case 'a':
00260                         k +=10;
00261                         break;
00262                 case 'b':
00263                         k +=11;
00264                         break;
00265                 case 'c':
00266                         k +=12;
00267                         break;
00268                 case 'd':
00269                         k +=13;
00270                         break;
00271                 case 'e':
00272                         k +=14;
00273                         break;
00274                 case 'f':
00275                         k +=15;
00276                         break;
00277 
00278                 case 'A':
00279                         k +=10;
00280                         break;
00281                 case 'B':
00282                         k +=11;
00283                         break;
00284                 case 'C':
00285                         k +=12;
00286                         break;
00287                 case 'D':
00288                         k +=13;
00289                         break;
00290                 case 'E':
00291                         k +=14;
00292                         break;
00293                 case 'F':
00294                         k +=15;
00295                         break;
00296 
00297                 case 0:
00298                         return k;
00299                         break;
00300                 }
00301                 if(*ident != 0) k *= base;
00302         }
00303 
00304         return k;
00305 */
00306 }

uint32 NLMISC::atoui const char *  ident  )  [inline]
 

Definition at line 481 of file i_xml.cpp.

References atoui(), and uint32.

Referenced by atoui(), NLMISC::CStringStream::serial(), and NLMISC::CMemStream::serial().

00482 {
00483         return (uint32) strtoul (ident, NULL, 10);
00484 }

void NLMISC::beep uint  freq,
uint  duration
 

Definition at line 974 of file debug.cpp.

References uint.

Referenced by NLNET::IService::main().

00975 {
00976 #ifdef NL_OS_WINDOWS
00977         Beep( freq, duration );
00978 #endif
00979 }

uint32 blend uint32 n0,
uint32 n1,
uint32  coef0
 

void blendFromui NLMISC::CRGBA c0,
NLMISC::CRGBA c1,
uint  coef
 

void BuildHermiteVector const NLMISC::CVector2f P0,
const NLMISC::CVector2f P1,
const NLMISC::CVector2f T0,
const NLMISC::CVector2f T1,
NLMISC::CVector2f dest,
float  lambda
[inline, static]
 

build some hermite spline value, with the given points and tangents

just avoid some ctor calls here...

Definition at line 33 of file mouse_smoother.cpp.

References NLMISC::CVector2f::set(), NLMISC::CVector2f::x, and NLMISC::CVector2f::y.

Referenced by NLMISC::CMouseSmoother::samplePos().

00040 {               
00041         const float lambda2 = lambda * lambda;
00042         const float lambda3 = lambda2 * lambda;
00043         const float h1 = 2 * lambda3 - 3 * lambda2 + 1; 
00044         const float h2 = - 2 * lambda3 + 3 * lambda2; 
00045         const float h3 = lambda3 - 2 * lambda2 + lambda; 
00046         const float h4 = lambda3 - lambda2;
00048         dest.set(h1 * P0.x + h2 * P1.x + h3 * T0.x + h4 * T1.x,
00049                 h1 * P0.y + h2 * P1.y + h3 * T0.y + h4 * T1.y);
00050 }

std::string NLMISC::bytesToHumanReadable uint32  bytes  ) 
 

Definition at line 405 of file common.cpp.

References res, toString(), uint, and uint32.

00406 {
00407         static char *divTable[]= { "b", "kb", "mb", "gb" };
00408         uint div = 0;
00409         uint32 res = bytes;
00410         uint32 newres = res;
00411         while (true)
00412         {
00413                 newres /= 1024;
00414                 if(newres < 8 || div > 2)
00415                         break;
00416                 div++;
00417                 res = newres;
00418         }
00419         return toString ("%u%s", res, divTable[div]);
00420 }

std::string NLMISC::bytesToHumanReadable const std::string &  bytes  ) 
 

Convert a number in bytes into a string that is easily readable by an human, for example 105123 -> "102kb".

Definition at line 388 of file common.cpp.

References atoiInt64(), NL_I64, res, toString(), uint, and uint64.

Referenced by NLMISC_COMMAND(), and NLMISC_DYNVARIABLE().

00389 {
00390         static char *divTable[]= { "b", "kb", "mb", "gb" };
00391         uint div = 0;
00392         uint64 res = atoiInt64(bytes.c_str());
00393         uint64 newres = res;
00394         while (true)
00395         {
00396                 newres /= 1024;
00397                 if(newres < 8 || div > 2)
00398                         break;
00399                 div++;
00400                 res = newres;
00401         }
00402         return toString ("%"NL_I64"u%s", res, divTable[div]);
00403 }

void cbInvalidEntityNamesFilename const std::string &  invalidEntityNamesFilename  ) 
 

Definition at line 370 of file eid_translator.cpp.

References NLMISC::CEntityIdTranslator::InvalidEntityNames, and nlwarning.

Referenced by NLMISC::CEntityIdTranslator::load().

00371 {
00372         CEntityIdTranslator::getInstance()->InvalidEntityNames.clear ();
00373 
00374         string fn = CPath::lookup(invalidEntityNamesFilename, false);
00375 
00376         if (fn.empty())
00377         {
00378                 nlwarning ("EIT: Can't load filename '%s' for invalid entity names filename (not found)", invalidEntityNamesFilename.c_str());
00379                 return;
00380         }
00381 
00382         FILE *fp = fopen (fn.c_str(), "r");
00383         if (fp == NULL)
00384         {
00385                 nlwarning ("EIT: Can't load filename '%s' for invalid entity names filename", fn.c_str());
00386                 return;
00387         }
00388 
00389         while (true)
00390         {
00391                 char str[512];
00392                 fgets(str, 511, fp);
00393                 if(feof(fp))
00394                         break;
00395                 if (strlen(str) > 0)
00396                 {
00397                         str[strlen(str)-1] = '\0';
00398                         CEntityIdTranslator::getInstance()->InvalidEntityNames.push_back(str);
00399                 }
00400         }
00401         
00402         fclose (fp);
00403 }

void cbVarChanged CConfigFile::CVar cvar  ) 
 

Definition at line 36 of file variable.cpp.

References NLMISC::CConfigFile::CVar::asString(), NLMISC::IVariable::fromString(), NLMISC::CConfigFile::CVar::Name, and nlinfo.

Referenced by NLMISC::IVariable::init().

00037 {
00038         for (ICommand::TCommand::iterator comm = (*ICommand::Commands).begin(); comm != (*ICommand::Commands).end(); comm++)
00039         {
00040                 if ((*comm).second->Type == ICommand::Variable && (*comm).second->_CommandName == cvar.Name)
00041                 {
00042                         IVariable *var = (IVariable *)((*comm).second);
00043                         string val = cvar.asString();
00044                         nlinfo ("VAR: Setting variable '%s' with value '%s' from config file", cvar.Name.c_str(), val.c_str());
00045                         var->fromString(val, true);
00046                 }
00047         }
00048 }

void NLMISC::changeLogDirectory const std::string &  dir  ) 
 

Definition at line 893 of file debug.cpp.

References fd, and NLMISC::CFileDisplayer::setParam().

Referenced by NLNET::IService::main().

00894 {
00895         if (fd == NULL)return;
00896         string p = CPath::standardizePath(dir) + "log.log";
00897         fd->setParam(p);
00898 }

void CHeapAllocatorOutputError const char *  str  ) 
 

Definition at line 59 of file misc/heap_allocator.cpp.

Referenced by NLMISC::CHeapAllocator::debugReportMemoryLeak().

00060 {
00061         fprintf (stderr, str);
00062 #ifdef NL_OS_WINDOWS
00063         OutputDebugString (str);
00064 #endif // NL_OS_WINDOWS
00065 }

template<class T, class U, class V>
void clamp T &  v,
const U &  min,
const V &  max
[inline]
 

Force v to be inside the interval [min,max]. Warning: implicit cast are made if T,U or V are different.

Definition at line 115 of file common.h.

References min, and v.

Referenced by NL3D::CVisualCollisionManager::CStaticGrid::add(), NL3D::CLodCharacterShape::addAnim(), NL3D::CQuadGridClipCluster::addModel(), NLSOUND::CBackgroundSoundManager::addSound(), NL3D::CPatch::appendTileLightInfluences(), NL3D::CMeshMRMSkinnedGeom::applyGeomorphWithVBHardPtr(), NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CMRMBuilder::attToColor(), NL3D::CMeshVPWindTree::begin(), NL3D::CMeshVPWindTree::beginMBRInstance(), NL3D::CTextureFile::buildBitmapFromFile(), NLMISC::CRGBA::buildFromHLS(), NL3D::CZoneLighter::calcSkyContribution(), NLMISC::CVectorD::cartesianToSpheric(), NLMISC::CVector::cartesianToSpheric(), NL3D::CFastHLSModifier::CFastHLSModifier(), NL3D::CQuadGridClipClusterQTreeNode::clip(), NL3D::CDriverGL::clipRect(), NL3D::CPatch::computeDisplaceRawInteger(), NL3D::CPatch::computeGeomorphAlphaFar1VertexListVB(), NL3D::CTessVertex::computeGeomPos(), NL3D::CPointLight::computeLinearAttenuation(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CLoadBalancingGroup::computeRatioAndSmooth(), NL3D::CPSParticle::computeSrcStep(), NL3D::CPatch::computeTileLightmapPixelAutomatic(), NL3D::CFastHLSModifier::convertRGBABitmap(), NLGEORGES::CFormElm::convertValue(), NL3D::copyToValue(), NL3D::CRadixSort< T >::CRadixSort(), NL3D::CTileLumel::createUncompressed(), NL3D::CTextureEmboss::doGenerate(), NLPACS::CGlobalRetriever::doMove(), NLMISC::CNoiseColorGradient::eval(), CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::evalKey(), CTrackKeyFramerTCB< CKeyT, T >::evalKey(), NL3D::CTrackKeyFramerLinear< CKeyQuat, CQuat >::evalKey(), NL3D::CTrackKeyFramerLinear< CKeyRGBA, NLMISC::CRGBA >::evalKey(), CTrackKeyFramerBezier< CKeyBezierQuat, CQuat >::evalKey(), CTrackKeyFramerBezier< CKeyT, T >::evalKey(), NL3D::CTrackSampledCommon::evalTime(), NL3D::CTargetAnimCtrl::execute(), NL3D::fastClamp01(), fastClamp8(), NL3D::CDriverGL::forceTextureResize(), NL3D::CPatchDLMContext::generate(), NL3D::CPatch::generateTileVegetable(), NLSOUND::CClusteredSound::getAABoxNearestPos(), NL3D::CLodCharacterShape::getAnimKey(), NLMISC::CBitmap::getColorInterp(), NL3D::CMRMLevelDetail::getLevelDetailFromPolyCount(), NL3D::CAnimationPlaylist::getLocalTime(), NL3D::CPatch::getLumel(), NL3D::CZoneLighter::getMaxPhi(), NL3D::CDriverGL::getSpecularCubeMap(), NL3D::CSurfaceLightGrid::getStaticLightSetup(), NL3D::CPatch::getTesselatedPos(), NL3D::CZoneLighter::getTexture(), NL3D::CPatch::getTileElement(), NL3D::CPSFloatCurveFunctor::getValue(), NL3D::CViewport::init(), NL3D::CTessFacePriorityList::init(), NL3D::CZoneLighter::lightWater(), NLSOUND::CBackgroundSoundManager::loadSoundsFromPrimitives(), NL3D::CCameraCol::minimizeDistanceAgainstTri(), NL3D::CQuadGridClipClusterQTreeNode::noFrustumClip(), NL3D::NormalizeDsDt(), NL3D::NormalizeDsDtAsRGBA(), NL3D::CInstanceLighter::CPredPointLightToPoint::operator()(), NL3D::CVector3s::pack(), NL3D::CZoneLighter::processCalc(), NL3D::CShadowMap::processFades(), NL3D::CZoneLighter::processZonePointLightRT(), NLPACS::CPrimitiveWorldImage::reaction(), NLLIGO::IPrimitive::read(), ReadColor(), NL3D::CVegetableManager::render(), NL3D::CScene::render(), NL3D::CShadowMapManager::renderGenerate(), NL3D::CShadowMapManager::renderProject(), RenderTriangle(), NLMISC::CMouseSmoother::samplePos(), NL3D::CVisualCollisionManager::CStaticGrid::select(), NL3D::CPatchUVLocator::selectPatch(), NL3D::UWaterHeightMapManager::setBlendFactor(), NLSOUND::CSourceDSound::setGain(), NL3D::CParticleSystem::setGlobalValue(), NL3D::CLightingManager::setLightTransitionThreshold(), NL3D::CParticleSystem::setMaxDistLODBias(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::setNormal(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::setPos(), NL3D::CVisualCollisionManager::setSunContributionPower(), NL3D::CDriverGL::setupScissor(), NL3D::CPointLight::setupSpotAngle(), NL3D::CLandscape::setupStaticLight(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::setupViewport(), NL3D::CParticleSystem::setUserParam(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::setUV(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::setWeight(), NL3D::CVegetableManager::setWind(), NL3D::CPSLight::show(), NL3D::CParticleSystem::step(), NL3D::CSkeletonModel::traverseAnimDetail(), NL3D::CMeshMorpher::update(), NL3D::CAnimatedMaterial::update(), NLSOUND::CBackgroundSoundManager::updateBackgroundStatus(), NL3D::CPSRibbonBase::updateLOD(), NL3D::CParticleSystem::updateLODRatio(), NL3D::CMeshMorpher::updateSkinned(), NLSOUND::CSourceDSound::updateVolume(), and NL3D::CDriverGL::uploadTexture().

00116 {
00117         v = (v < min) ? min : v;
00118         v = (v > max) ? max : v;
00119 }

template<class T, class U>
T computeBilinear const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const U &  s,
const U &  t
 

bilinear of 4 values v3 v2 +-----+ | | | | +-----+ v0 v1

T ^ | | +---> S

Definition at line 55 of file algo.h.

References s, and t.

00056 {
00057         T h0 = t * v3 + ((U) 1 - t) * v0;
00058         T h1 = t * v2 + ((U) 1 - t) * v1;
00059         return s * h1 + ((U) 1 - s) * h0;
00060 }

template<class T>
void contReset T &  a  )  [inline]
 

contReset take a container like std::vector or std::deque and put his size to 0 like clear() but free all buffers. This function is useful because resize(), clear(), erase() or reserve() methods never realloc when the array size come down.

Parameters:
a is the container to reset.

Definition at line 141 of file common.h.

Referenced by NLMISC::CBitmap::alphaLuminanceToAlpha(), NLMISC::CBitmap::alphaLuminanceToLuminance(), NLMISC::CStaticStringMapper::clear(), NL3D::CLinearEquation::clear(), NLPACS::CFaceGrid::clear(), NLPACS::CExteriorMesh::clear(), NLPACS::CChainQuad::clear(), NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::contReset(), NL3D::CTileFarBank::CTileFar::erasePixels(), NLMISC::CSheetId::loadSheetId(), NL3D::CZoneLighter::makeQuadGridFromWaterShapes(), NLMISC::CStaticStringMapper::memoryCompress(), NLMISC::CStaticStringMapper::memoryUncompress(), NL3D::CPSRibbonBase::motionTypeChanged(), NLMISC::CBitmap::releaseMipMaps(), NL3D::CPSLocated::releaseParametricInfos(), NLMISC::CBitmap::resample(), NLMISC::CHTimer::CNode::reset(), NLMISC::CBitmap::reset(), NLMISC::CBitmap::resizeMipMap(), NLMISC::CBitmap::rgbaToAlpha(), NLMISC::CBitmap::rgbaToAlphaLuminance(), NLMISC::CBitmap::rgbaToLuminance(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::CStringStream::serialCont(), NLMISC::CBitMemStream::serialCont(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), NLMISC::IStream::serialVectorPtr(), and NL3D::CCluster::unlinkSons().

00142 {
00143         a.~T();
00144 #undef new
00145         new (&a) T;
00146 #define new NL_NEW
00147 }

bool CopyMoveFile const char *  dest,
const char *  src,
bool  copyFile,
bool  failIfExists = false
[static]
 

Definition at line 1601 of file path.cpp.

References nlwarning.

01602 {
01603         if (!dest || !src) return false;
01604         if (!strlen(dest) || !strlen(src)) return false;        
01605 #ifdef NL_OS_WINDOWS
01606         std::string dosdest = CPath::standardizeDosPath(dest);
01607         std::string dossrc = CPath::standardizeDosPath(src);
01608 
01609         return copyFile  ? CopyFile(dossrc.c_str(), dosdest.c_str(), failIfExists) != FALSE
01610                                          : MoveFile(dossrc.c_str(), dosdest.c_str()) != FALSE;
01611 #else
01612         std::string sdest = CPath::standardizePath(dest,false);
01613         std::string ssrc = CPath::standardizePath(src,false);
01614 
01615         if(copyFile)
01616           {
01617                 FILE *fp1 = fopen(ssrc.c_str(), "rb");
01618                 if (fp1 == NULL)
01619                   {
01620                         nlwarning ("PATH: CopyMoveFile error: can't fopen in read mode '%s'", ssrc.c_str());
01621                         return false;
01622                   }
01623                 FILE *fp2 = fopen(sdest.c_str(), "wb");
01624                 if (fp2 == NULL)
01625                   {
01626                         nlwarning ("PATH: CopyMoveFile error: can't fopen in read write mode '%s'", sdest.c_str());
01627                         return false;
01628                   }
01629                 static char buffer [1000];
01630                 int s;
01631                 for(s = fread(buffer, 1, sizeof(buffer), fp1); s > 0 && (s = fread(buffer, 1, sizeof(buffer), fp1)) ; fwrite(buffer, 1, s, fp2));
01632                 fclose(fp1);
01633                 fclose(fp2);
01634           }
01635         else
01636           {
01637                 if (link (ssrc.c_str(), sdest.c_str()) == -1)
01638                   {
01639                         nlwarning ("PATH: CopyMoveFile error: can't link '%s' into '%s'", ssrc.c_str(), sdest.c_str());
01640                         return false;
01641                   }
01642 
01643                 if (unlink (ssrc.c_str()) == -1)
01644                   {
01645                         nlwarning ("PATH: CopyMoveFile error: can't unlink '%s'", ssrc.c_str());
01646                         return false;
01647                   }
01648           }
01649           return true;
01650 #endif  
01651 }

void NLMISC::createDebug const char *  logPath = NULL,
bool  logInFile = true
 

Definition at line 900 of file debug.cpp.

References AssertLog, DebugLog, DefaultMemDisplayer, DefaultMsgBoxDisplayer, ErrorLog, fd, InfoLog, initDebug2(), IsDebuggerPresent, sd, TrapCrashInDebugger, and WarningLog.

Referenced by NLNET::CCallbackNetBase::CCallbackNetBase(), and NLMISC::CConfigFile::display().

00901 {
00902         NL_ALLOC_CONTEXT (_Debug)
00903         
00904         static bool alreadyCreateSharedAmongThreads = false;
00905         if ( !alreadyCreateSharedAmongThreads )
00906         {
00907                 // Debug Info for mutexes
00908 #ifdef MUTEX_DEBUG
00909                 initAcquireTimeMap();
00910 #endif
00911 
00912 #ifdef NL_OS_WINDOWS
00913 //              if (!IsDebuggerPresent ())
00914                 {
00915                         // Use an environment variable to share the value among the EXE and its child DLLs
00916                         // (otherwise there would be one distinct bool by module, and the last
00917                         // _set_se_translator would overwrite the previous ones)
00918                         const char *SE_TRANSLATOR_IN_MAIN_MODULE = "NEL_SE_TRANS";
00919                         TCHAR envBuf [2];
00920                         if ( GetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, envBuf, 2 ) == 0)
00921                         {
00922                                 _set_se_translator(exceptionTranslator);
00923                                 SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, "1" );
00924                         }
00925                 }
00926 #endif // NL_OS_WINDOWS
00927 
00928                 ErrorLog = new CLog (CLog::LOG_ERROR);
00929                 WarningLog = new CLog (CLog::LOG_WARNING);
00930                 InfoLog = new CLog (CLog::LOG_INFO);
00931                 DebugLog = new CLog (CLog::LOG_DEBUG);
00932                 AssertLog = new CLog (CLog::LOG_ASSERT);
00933 
00934                 sd = new CStdDisplayer ("DEFAULT_SD");
00935 
00936 #ifdef NL_OS_WINDOWS
00937                 if (TrapCrashInDebugger || !IsDebuggerPresent ())
00938                 {
00939                         DefaultMsgBoxDisplayer = new CMsgBoxDisplayer ("DEFAULT_MBD");
00940                 }
00941 #endif
00942 
00943 #if LOG_IN_FILE
00944                 if (logInFile)
00945                 {
00946                         string fn;
00947                         if (logPath != NULL)
00948                         {
00949                                 fn += logPath;
00950                         }
00951                         else
00952                         {
00953 // we want the log.log to be in the current directory
00954 //                              char    tmpPath[1024];
00955 //                              fn += getcwd(tmpPath, 1024);
00956 //                              fn += "/";
00957                         }
00958                         fn += "log.log";
00959                         fd = new CFileDisplayer (fn, false, "DEFAULT_FD");
00960                 }
00961 #endif // LOG_IN_FILE
00962                 DefaultMemDisplayer = new CMemDisplayer ("DEFAULT_MD");
00963                 
00964                 initDebug2(logInFile);
00965 
00966                 alreadyCreateSharedAmongThreads = true;
00967         }
00968 }

float degToRad float  deg  )  [inline]
 

Converts from degrees to radians

Definition at line 170 of file common.h.

References Pi.

Referenced by NLSOUND::CSourceAL::getCone().

00171 {
00172         return deg * (float)Pi / 180.0f;
00173 }

bool NLMISC::DetectMMX void   )  [static]
 

Definition at line 34 of file cpu_info.cpp.

References uint32.

00035 {               
00036         #ifdef NL_OS_WINDOWS            
00037                 if (!CCpuInfo___::hasCPUID()) return false; // cpuid not supported ...
00038 
00039                 uint32 result = 0;
00040                 __asm
00041                 {
00042                          mov  eax,1
00043                          cpuid
00044                          test edx,0x800000  // bit 23 = MMX instruction set
00045                          je   noMMX
00046                          mov result, 1  
00047                         noMMX:
00048                 }
00049 
00050                 return result == 1;
00051  
00052                 // printf("mmx detected\n");
00053 
00054         #else
00055                 return false;
00056         #endif
00057 }

bool NLMISC::DetectSSE void   )  [static]
 

Definition at line 60 of file cpu_info.cpp.

References uint32.

00061 {       
00062         #ifdef NL_OS_WINDOWS
00063                 if (!CCpuInfo___::hasCPUID()) return false; // cpuid not supported ...
00064 
00065                 uint32 result = 0;
00066                 __asm
00067                 {                       
00068                         mov eax, 1   // request for feature flags
00069                         cpuid                                                   
00070                         test EDX, 002000000h   // bit 25 in feature flags equal to 1
00071                         je noSSE
00072                         mov result, 1  // sse detected
00073                 noSSE:
00074                 }
00075 
00076 
00077                 if (result)
00078                 {
00079                         // check OS support for SSE
00080                         try 
00081                         {
00082                                 __asm
00083                                 {
00084                                         xorps xmm0, xmm0  // Streaming SIMD Extension
00085                                 }
00086                         }
00087                         catch(...)
00088                         {
00089                                 return false;
00090                         }
00091                 
00092                         // printf("sse detected\n");
00093 
00094                         return true;
00095                 }
00096                 else
00097                 {
00098                         return false;
00099                 }
00100         #else
00101                 return false;
00102         #endif
00103 }

void NLMISC::displayBitStream const CBitMemStream &  msg,
sint  beginbitpos,
sint  endbitpos,
NLMISC::CLog log = NLMISC::DebugLog
 

Display a part of a bitmemstream.

Definition at line 652 of file bit_mem_stream.cpp.

References NLMISC::CMemStream::buffer(), displayByteBits(), nlinfo, sint, and uint8.

Referenced by NLMISC::CBitMemStream::displayLastBits().

00653 {
00654         sint beginpos = beginbitpos/8;
00655         sint endpos = endbitpos/8;
00656         nlinfo( "BMS: beginpos %d endpos %d beginbitpos %d endbitpos %d", beginpos, endpos, beginbitpos, endbitpos );
00657         displayByteBits( *(msg.buffer()+beginpos), 8, 8-(beginbitpos-beginpos*8), true, log );
00658         const uint8 *p;
00659         for ( p=msg.buffer()+beginpos+1; p<msg.buffer()+endpos-1; ++p )
00660         {
00661                 displayByteBits( *p, 8, 0, false, log );
00662         }
00663         if ( endpos > beginpos )
00664         {
00665                 displayByteBits( *(msg.buffer()+endpos), 8, 0, false, log );
00666         }
00667 }

void NLMISC::displayByteBits uint8  b,
uint  nbits,
sint  beginpos,
bool  displayBegin,
NLMISC::CLog log
 

Display the bits (with 0 and 1) composing a byte (from right to left).

Definition at line 856 of file common.cpp.

References NLMISC::CLog::displayRawNL(), sint, uint, and uint8.

Referenced by displayBitStream().

00857 {
00858         string s1, s2;
00859         sint i;
00860         for ( i=nbits-1; i!=-1; --i )
00861         {
00862                 s1 += ( (b >> i) & 1 ) ? '1' : '0';
00863         }
00864         log->displayRawNL( "%s", s1.c_str() );
00865         if ( displayBegin )
00866         {
00867                 for ( i=nbits; i>beginpos+1; --i )
00868                 {
00869                         s2 += " ";
00870                 }
00871                 s2 += "^";
00872                 log->displayRawNL( "%s beginpos=%u", s2.c_str(), beginpos );
00873         }
00874 }

void displayCallStack CLog *  log  )  [static]
 

Definition at line 307 of file mem_displayer.cpp.

References NLMISC::CLog::displayNL().

Referenced by NLMISC::CMemDisplayer::write().

00308 {
00309         log->displayNL ("no call stack info available");
00310 }

void NLMISC::displayDwordBits uint32  b,
uint  nbits,
sint  beginpos,
bool  displayBegin,
NLMISC::CLog log
 

Display the bits (with 0 and 1) composing a number (uint32) (from right to left).

Definition at line 882 of file common.cpp.

References NLMISC::CLog::displayRawNL(), sint, uint, and uint32.

00883 {
00884         string s1, s2;
00885         sint i;
00886         for ( i=nbits-1; i!=-1; --i )
00887         {
00888                 s1 += ( (b >> i) & 1 ) ? '1' : '0';
00889         }
00890         log->displayRawNL( "%s", s1.c_str() );
00891         if ( displayBegin )
00892         {
00893                 for ( i=nbits; i>beginpos+1; --i )
00894                 {
00895                         s2 += " ";
00896                 }
00897                 s2 += "^";
00898                 log->displayRawNL( "%s beginpos=%u", s2.c_str(), beginpos );
00899         }
00900 }

void NLMISC::drawFullLine float  x0,
float  y0,
float  x1,
float  y1,
std::vector< std::pair< sint, sint > > &  result
 

Select all points crossed by the line [(x0,y0) ; (x1,y1)] Not the same than brensenham

Definition at line 142 of file algo.cpp.

References sint.

Referenced by draw2dLine().

00143 {
00144         result.clear ();
00145         // x0 must be < x1
00146         float dx = (float) fabs (x0-x1);
00147         float dy = (float) fabs (y0-y1);
00148         if ((dx == 0) && (dy == 0))
00149                 result.push_back (pair<sint, sint> ((sint)floor (x0), (sint)floor (y0)));
00150         else if (dx > dy)
00151         {
00152                 if (x0 > x1)
00153                 {
00154                         // Xchg 0 and 1
00155                         float temp = x0;
00156                         x0 = x1;
00157                         x1 = temp;
00158                         temp = y0;
00159                         y0 = y1;
00160                         y1 = temp;
00161                 }
00162 
00163                 float deltaX = x1 - x0;
00164                 const float deltaY = (y1-y0)/deltaX;
00165 
00166                 // Current integer pixel
00167                 sint currentX = (sint)floor (x0);
00168                 sint currentY = (sint)floor (y0);
00169 
00170                 while (deltaX >= 0)
00171                 {
00172                         // Next point
00173                         sint previousY = currentY;
00174 
00175                         // Next y0
00176                         if (deltaX > 1) 
00177                                 y0 += deltaY;
00178                         else
00179                                 y0 += deltaX * deltaY;
00180 
00181                         deltaX -= 1;
00182 
00183                         currentY = (sint)y0;
00184                         
00185                         // Add point
00186                         if (currentY<=previousY)
00187                         {
00188                                 do
00189                                 {
00190                                         result.push_back (pair<sint, sint> (currentX, previousY));
00191                                         previousY--;
00192                                 }
00193                                 while (currentY<=previousY);
00194                         }
00195                         else
00196                         {
00197                                 do
00198                                 {
00199                                         result.push_back (pair<sint, sint> (currentX, previousY));
00200                                         previousY++;
00201                                 }
00202                                 while (currentY>=previousY);
00203                         }
00204 
00205                         // Next X
00206                         currentX++;
00207                 }
00208         }
00209         else 
00210         {
00211                 if (y0 > y1)
00212                 {
00213                         // Xchg 0 and 1
00214                         float temp = y0;
00215                         y0 = y1;
00216                         y1 = temp;
00217                         temp = x0;
00218                         x0 = x1;
00219                         x1 = temp;
00220                 }
00221 
00222                 float deltaY = y1 - y0;
00223                 const float deltaX = (x1-x0)/deltaY;
00224 
00225                 // Current integer pixel
00226                 sint currentY = (sint)floor (y0);
00227                 sint currentX = (sint)floor (x0);
00228 
00229                 while (deltaY >= 0)
00230                 {
00231                         // Next point
00232                         sint previousX = currentX;
00233 
00234                         // Next x0
00235                         if (deltaY > 1) 
00236                                 x0 += deltaX;
00237                         else
00238                                 x0 += deltaY * deltaX;
00239 
00240                         deltaY -= 1;
00241 
00242                         currentX = (sint)x0;
00243                         
00244                         // Add point
00245                         if (currentX<=previousX)
00246                         {
00247                                 do
00248                                 {
00249                                         result.push_back (pair<sint, sint> (previousX, currentY));
00250                                         previousX--;
00251                                 }
00252                                 while (currentX<=previousX);
00253                         }
00254                         else
00255                         {
00256                                 do
00257                                 {
00258                                         result.push_back (pair<sint, sint> (previousX, currentY));
00259                                         previousX++;
00260                                 }
00261                                 while (currentX>=previousX);
00262                         }
00263 
00264                         // Next Y
00265                         currentY++;
00266                 }
00267         }
00268 }

void drawLine float  x0,
float  y0,
float  x1,
float  y1,
std::vector< std::pair< sint, sint > > &  result
 

Select points on the line [(x0,y0) ; (x1,y1)]

void drawLine float  x0,
float  y0,
float  x1,
float  y1,
vector< pair< sint, sint > > &  result
 

Definition at line 272 of file algo.cpp.

References sint.

00273 {
00274         float   dx = (float)(floor(x1+0.5) - floor(x0+0.5));
00275         float   dy = (float)(floor(y1+0.5) - floor(y0+0.5));
00276 
00277         float   rdx = x1-x0;
00278         float   rdy = y1-y0;
00279 
00280         sint    d = (sint)std::max(fabs(dx), fabs(dy));
00281         float   maxd = (float)(std::max(fabs(rdx), fabs(rdy)));
00282 
00283         rdx /= maxd;
00284         rdy /= maxd;
00285 
00286         for (; d>=0; --d)
00287         {
00288                 result.push_back(make_pair<sint,sint>((sint)floor(x0+0.5), (sint)floor(y0+0.5)));
00289 
00290                 x0 += rdx;
00291                 y0 += rdy;
00292         }
00293 }

void enterBreakpoint const char *  message  ) 
 

void NLMISC::explode const std::string &  src,
const std::string &  sep,
std::vector< std::string > &  res,
bool  skipEmpty = false
 

Explode a string into a vector of string with *sep* as separator. If sep can be more than 1 char, in this case, we find the entire sep to separator (it s not a set of possible separator)

Parameters:
skipEmpty if true, we don't put in the res vector empty string

Definition at line 821 of file common.cpp.

References res, s, and src.

Referenced by STRING_MANAGER::preparePhraseFile(), and STRING_MANAGER::prepareStringFile().

00822 {
00823         string::size_type oldpos = 0, pos;
00824 
00825         res.clear ();
00826 
00827         do
00828         {
00829                 pos = src.find (sep, oldpos);
00830                 string s;
00831                 if(pos == string::npos)
00832                         s = src.substr (oldpos);
00833                 else
00834                         s = src.substr (oldpos, (pos-oldpos));
00835 
00836                 if (!skipEmpty || !s.empty())
00837                         res.push_back (s);
00838 
00839                         oldpos = pos+1;
00840         }
00841         while(pos != string::npos);
00842 
00843         // debug
00844 /*      nlinfo ("Exploded '%s', with '%s', %d res", src.c_str(), sep.c_str(), res.size());
00845         for (uint i = 0; i < res.size(); i++)
00846         {
00847                 nlinfo (" > '%s'", res[i].c_str());
00848         }
00849 */
00850 }

void fastClamp8 sint v  )  [inline, static]
 

Clamp a sint in 0..255. Avoid cond jump.

Definition at line 122 of file algo.h.

References clamp(), sint, and v.

00123 {
00124 #ifdef NL_OS_WINDOWS
00125         // clamp v in 0..255 (no cond jmp)
00126         __asm
00127         {
00128                 mov             esi, v
00129                 mov             eax, [esi]
00130                 mov             ebx, eax
00131                 // clamp to 0.
00132                 add             eax, 0x80000000
00133                 sbb             ecx, ecx
00134                 not             ecx
00135                 and             ebx, ecx
00136                 // clamp to 255.
00137                 add             eax, 0x7FFFFF00
00138                 sbb             ecx, ecx
00139                 or              ebx, ecx
00140                 and             ebx, 255
00141                 // store
00142                 mov             [esi], ebx
00143         }
00144 #else
00145         clamp(v, 0, 255);
00146 #endif
00147 }

memcpyPtr findBestmemcpy  )  [static]
 

Definition at line 227 of file fast_mem.cpp.

References memcpyPtr.

00228 {
00229 #ifdef NL_OS_WINDOWS
00230         if (CSystemInfo::hasSSE ())
00231                 return CFastMem::memcpySSE;
00232         else
00233                 return ::memcpy;
00234 #else // NL_OS_WINDOWS
00235         return ::memcpy;
00236 #endif // NL_OS_WINDOWS
00237 }

void fprintf_int uint  value  ) 
 

Definition at line 1368 of file misc/heap_allocator.cpp.

References uint, and value.

01369 {
01370         
01371 }

float frand float  mod  )  [inline]
 

Return a float random inside the interval [0,mod]

Definition at line 84 of file common.h.

References r.

Referenced by NLMISC::CRandomGrid3D::CRandomGrid3D(), and NL3D::CMeshVPWindTree::initInstance().

00085 {
00086         double  r = (double) rand();
00087         r/= (double) RAND_MAX;
00088         return (float)(r * mod);
00089 }

uint32 NLMISC::fromHumanReadable const std::string &  str  ) 
 

Get a bytes or time in string format and convert it in seconds or bytes.

Definition at line 499 of file common.cpp.

References uint32.

00500 {
00501         if (str.size() == 0)
00502                 return 0;
00503 
00504         uint32 val = atoi (str.c_str());
00505 
00506         switch (str[str.size()-1])
00507         {
00508         case 's': return val;                   // second
00509         case 'n': return val*60;                // minutes (mn)
00510         case 'h': return val*60*60;             // hour
00511         case 'd': return val*60*60*24;  // day
00512         case 'b':       // bytes
00513                 switch (str[str.size()-2])
00514                 {
00515                 case 'k': return val*1024;
00516                 case 'm': return val*1024*1024;
00517                 case 'g': return val*1024*1024*1024;
00518                 default : return val;
00519                 }
00520         default: return val;
00521         }
00522         return 0;
00523 }

void fromString const std::string &  str,
std::string &  val
[inline]
 

Definition at line 214 of file string_common.h.

00214 { val = str; }

void fromString const std::string &  str,
bool &  val
[inline]
 

Definition at line 213 of file string_common.h.

References fromString(), uint32, and v.

00213 { uint32 v; fromString(str, v); val = (v==1); }

void fromString const std::string &  str,
double &  val
[inline]
 

Definition at line 212 of file string_common.h.

00212 { sscanf(str.c_str(), "%lf", &val); }

void fromString const std::string &  str,
float &  val
[inline]
 

Definition at line 211 of file string_common.h.

00211 { sscanf(str.c_str(), "%f", &val); }

void fromString const std::string &  str,
sint64 val
[inline]
 

Definition at line 210 of file string_common.h.

References NL_I64, and sint64.

00210 { sscanf(str.c_str(), "%"NL_I64"d", &val); }

void fromString const std::string &  str,
uint64 val
[inline]
 

Definition at line 209 of file string_common.h.

References NL_I64, and uint64.

00209 { sscanf(str.c_str(), "%"NL_I64"u", &val); }

void fromString const std::string &  str,
sint16 val
[inline]
 

Definition at line 208 of file string_common.h.

References fromString(), sint16, uint32, and v.

00208 { uint32 v; fromString(str, v); val = (sint16)v; }

void fromString const std::string &  str,
uint16 val
[inline]
 

Definition at line 207 of file string_common.h.

References fromString(), uint16, uint32, and v.

00207 { uint32 v; fromString(str, v); val = (uint16)v; }

void fromString const std::string &  str,
sint8 val
[inline]
 

Definition at line 206 of file string_common.h.

References fromString(), sint32, sint8, and v.

00206 { sint32 v; fromString(str, v); val = (sint8)v; }

void fromString const std::string &  str,
uint8 val
[inline]
 

Definition at line 205 of file string_common.h.

References fromString(), uint32, uint8, and v.

00205 { uint32 v; fromString(str, v); val = (uint8)v; }

void fromString const std::string &  str,
sint32 val
[inline]
 

Definition at line 204 of file string_common.h.

References sint32.

00204 { sscanf(str.c_str(), "%d", &val); }

void fromString const std::string &  str,
uint32 val
[inline]
 

Definition at line 203 of file string_common.h.

References uint32.

Referenced by NLMISC::CVariable< std::string >::execute(), NLMISC::CVariable< std::string >::fromString(), NLMISC::CVariablePtr< T >::fromString(), and fromString().

00203 { sscanf(str.c_str(), "%u", &val); }

sint fsgn double  f  )  [inline]
 

Return -1 if f<0, 0 if f==0, 1 if f>1

Definition at line 94 of file common.h.

References sint.

Referenced by NLPACS::CEdgeCollide::testPointMove().

00095 {
00096         if(f<0)
00097                 return -1;
00098         else if(f>0)
00099                 return 1;
00100         else
00101                 return 0;
00102 }

void NLMISC::getCallStackAndLog std::string &  result,
sint  skipNFirst = 0
 

Get the call stack and set it with result.

Definition at line 836 of file debug.cpp.

References CrashCallback, DefaultMemDisplayer, sint, and NLMISC::CMemDisplayer::write().

Referenced by NLMISC::CLog::displayRawString(), and NLMISC::CLog::displayString().

00837 {
00838 #ifdef NL_OS_WINDOWS
00839         try
00840         {
00841                 WORKAROUND_VCPP_SYNCHRONOUS_EXCEPTION // force to install a exception frame             
00842                         
00843                 DWORD array[1];
00844                 array[0] = skipNFirst;
00845                 RaiseException (0xACE0ACE, 0, 1, array);
00846         }
00847         catch (EDebug &e)
00848         {
00849                 result += e.what();
00850         }
00851 #else
00852 
00853         // there s no stack on GNU/Linux, only get the log without filters
00854 
00855         result += "No callstack available\n";
00856         result += "-------------------------------\n";
00857         result += "\n";
00858         if(DefaultMemDisplayer)
00859         {
00860                 result += "Log with no filter:\n";
00861                 result += "-------------------------------\n";
00862                 DefaultMemDisplayer->write (result);
00863         }
00864         else
00865         {
00866                 result += "No log\n";
00867         }
00868         result += "-------------------------------\n";
00869 
00870         // add specific information about the application
00871         if(CrashCallback)
00872         {
00873                 result += "User Crash Callback:\n";
00874                 result += "-------------------------------\n";
00875                 static bool looping = false;
00876                 if(looping)
00877                 {
00878                         result += "******* WARNING: crashed in the user crash callback *******\n";
00879                         looping = false;
00880                 }
00881                 else
00882                 {
00883                         looping = true;
00884                         result += CrashCallback();
00885                         looping = false;
00886                 }
00887                 result += "-------------------------------\n";
00888         }
00889         
00890 #endif
00891 }

string getname dirent *  de  ) 
 

Definition at line 678 of file path.cpp.

00679 {
00680         nlassert (de != NULL);
00681 #ifdef NL_OS_WINDOWS
00682         return de->cFileName;
00683 #else
00684         return de->d_name;
00685 #endif // NL_OS_WINDOWS
00686 }

uint NLMISC::getPowerOf2 uint  v  ) 
 

Return the power of 2 of v. Example: getPowerOf2(8) is 3 getPowerOf2(5) is 3

Definition at line 358 of file common.cpp.

References res, uint, and v.

Referenced by NL3D::CStaticQuadGrid< T >::build(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CZoneLighter::buildZoneInformation(), NL3D::CLandscapeCollisionGrid::CLandscapeCollisionGrid(), NL3D::CPatch::compile(), NL3D::CVisualCollisionManager::CStaticGrid::create(), NL3D::CQuadGrid< T >::create(), NLPACS::CFaceGrid::create(), NL3D::CDriverGL::forceTextureResize(), NL3D::CLandscapeFaceVectorManager::getBlockIdFromNumTri(), NL3D::CTextureFar::getFreeListId(), NL3D::CTextureDLM::getTypeForSize(), NL3D::CNoise3d::init(), NL3D::SCloudTextureClamp::init(), NL3D::SCloudTexture3D::init(), NL3D::CCloud::init(), and NLMISC::CBitmap::readDDS().

00359 {
00360         uint    res=1;
00361         uint    ret=0;
00362         while(res<v)
00363         {
00364                 ret++;
00365                 res<<=1;
00366         }
00367         
00368         return ret;
00369 }

uint NLMISC::getThreadId  ) 
 

Returns Process Id (note: on Linux, Process Id is the same as the Thread Id) Returns Thread Id (note: on Linux, Process Id is the same as the Thread Id).

Definition at line 93 of file common.cpp.

References uint.

Referenced by NLNET::CUnifiedNetwork::addService(), NLNET::CCallbackNetBase::CCallbackNetBase(), NLNET::CUnifiedNetwork::connect(), NLMISC::CLog::displayString(), NLNET::CUnifiedNetwork::getNetBase(), NLNET::CUnifiedNetwork::init(), NLNET::initSignal(), NLNET::CUnifiedNetwork::release(), NLNET::CUnifiedNetwork::send(), NLNET::CUnifiedNetwork::sendAll(), NLNET::sigHandler(), and NLNET::CUnifiedNetwork::update().

00094 {
00095 #ifdef NL_OS_WINDOWS
00096         return GetCurrentThreadId();
00097 #elif defined NL_OS_UNIX
00098         return getpid();
00099 #endif
00100 
00101 }

float HLSValue float  h,
float  v1,
float  v2
[static]
 

Used by buildFromHLS.

Definition at line 658 of file rgba.cpp.

Referenced by NLMISC::CRGBA::buildFromHLS().

00659 {
00660         /* get hue in the [0, 360] interval */
00661         // h -= 360.f * ::floorf(h / 360.f);
00662 
00663         if (h > 360.f) h -= 360.f;
00664         else if (h < 0) h += 360.f;
00665 
00666         if (h < 60.f)
00667         {
00668                 return v1 + (v2 - v1) * h / 60.f;
00669         }
00670         else if (h < 180.f)
00671         {
00672                 return v2;
00673         }
00674         else if (h < 240.f)
00675         {
00676                 return v1 + (v2 - v1) * (240.f - h) / 60.f;
00677         }
00678         else
00679         {
00680                 return v1;
00681         }                
00682 }

uint32 humanReadableToBytes const std::string &  str  ) 
 

Convert a human readable into a bytes, for example "102kb" -> 105123.

uint32 humanReadableToBytes const string &  str  ) 
 

Definition at line 422 of file common.cpp.

References res, and uint32.

Referenced by NLMISC_COMMAND(), and NLNET::updateAdmin().

00423 {
00424         uint32 res;
00425 
00426         if(str.empty())
00427                 return 0;
00428 
00429         // not a number
00430         if(str[0]<'0' || str[0]>'9')
00431                 return 0;
00432 
00433         res = atoi (str.c_str());
00434 
00435         if(str[str.size()-1] == 'b')
00436         {
00437                 if (str.size()<3)
00438                         return res;
00439 
00440                 // there s no break and it s **normal**
00441                 switch (str[str.size()-2])
00442                 {
00443                 case 'g': res *= 1024;
00444                 case 'm': res *= 1024;
00445                 case 'k': res *= 1024;
00446                 default: ;
00447                 }
00448         }
00449 
00450         return res;
00451 }

void initDebug2 bool  logInFile  ) 
 

Definition at line 154 of file debug.cpp.

References NLMISC::CLog::addDisplayer(), AssertLog, DebugLog, DefaultMemDisplayer, DefaultMsgBoxDisplayer, ErrorLog, fd, InfoLog, nlwarning, sd, and WarningLog.

Referenced by createDebug().

00155 {
00156         static bool alreadyInit = false;
00157 
00158         if (!alreadyInit)
00159         {
00160 #if DEFAULT_DISPLAYER
00161 
00162                 // put the standard displayer everywhere
00163 
00164 #ifdef NL_DEBUG
00165                 DebugLog->addDisplayer (sd);
00166 #endif // NL_DEBUG
00167                 InfoLog->addDisplayer (sd);
00168                 WarningLog->addDisplayer (sd);
00169                 AssertLog->addDisplayer (sd);
00170                 ErrorLog->addDisplayer (sd);
00171 
00172                 // put the memory displayer everywhere
00173 
00174                 // use the memory displayer and bypass all filter (even for the debug mode)
00175                 DebugLog->addDisplayer (DefaultMemDisplayer, true);
00176                 InfoLog->addDisplayer (DefaultMemDisplayer, true);
00177                 WarningLog->addDisplayer (DefaultMemDisplayer, true);
00178                 AssertLog->addDisplayer (DefaultMemDisplayer, true);
00179                 ErrorLog->addDisplayer (DefaultMemDisplayer, true);
00180 
00181                 // put the file displayer only if wanted
00182 
00183 #if LOG_IN_FILE
00184                 if (logInFile)
00185                 {
00186 #ifdef NL_DEBUG
00187                         DebugLog->addDisplayer (fd);
00188 #endif // NL_DEBUG
00189                         InfoLog->addDisplayer (fd);
00190                         WarningLog->addDisplayer (fd);
00191                         AssertLog->addDisplayer (fd);
00192                         ErrorLog->addDisplayer (fd);
00193                 }
00194 #endif // LOG_IN_FILE
00195 
00196                 // put the message box only in release for error
00197 
00198                 if (DefaultMsgBoxDisplayer)
00199                 {
00200                         AssertLog->addDisplayer (DefaultMsgBoxDisplayer);
00201                         ErrorLog->addDisplayer (DefaultMsgBoxDisplayer);
00202                 }
00203 
00204 #endif // DEFAULT_DISPLAYER
00205                 alreadyInit = true;
00206         }
00207         else
00208         {
00209                 nlwarning ("NLMISC::initDebug2() already called");
00210         }
00211 }

bool isdirectory dirent *  de  ) 
 

Definition at line 649 of file path.cpp.

00650 {
00651         nlassert (de != NULL);
00652 #ifdef NL_OS_WINDOWS
00653         return ((de->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) && ((de->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) == 0);
00654 #else
00655         //nlinfo ("isdirectory filename %s -> 0x%08x", de->d_name, de->d_type);
00656         // we can't use "de->d_type & DT_DIR" because it s always NULL on libc2.1
00657         //return (de->d_type & DT_DIR) != 0;
00658 
00659         return CFile::isDirectory (BasePathgetPathContent + de->d_name);
00660 
00661 #endif // NL_OS_WINDOWS
00662 }

bool isfile dirent *  de  ) 
 

Definition at line 664 of file path.cpp.

00665 {
00666         nlassert (de != NULL);
00667 #ifdef NL_OS_WINDOWS
00668         return ((de->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) && ((de->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) == 0);
00669 #else
00670         // we can't use "de->d_type & DT_DIR" because it s always NULL on libc2.1
00671         //return (de->d_type & DT_DIR) == 0;
00672 
00673         return !CFile::isDirectory (BasePathgetPathContent + de->d_name);
00674 
00675 #endif // NL_OS_WINDOWS
00676 }

bool NLMISC::isPowerOf2 sint32  v  ) 
 

Return true if the value is a power of 2.

Definition at line 371 of file common.cpp.

References sint32, and v.

Referenced by NL3D::CShadowMapManager::allocateTexture(), NLMISC::CBitmap::buildMipMaps(), NL3D::CZoneLighter::buildZoneInformation(), NL3D::CLandscapeCollisionGrid::CLandscapeCollisionGrid(), NL3D::CVisualCollisionManager::CStaticGrid::create(), NL3D::CTextureFar::getFreeListId(), NL3D::CTextureFar::getUpperSize(), NL3D::CTessFacePriorityList::init(), and NL3D::CShadowMapManager::renderGenerate().

00372 {
00373         while(v)
00374         {
00375                 if(v&1)
00376                 {
00377                         v>>=1;
00378                         if(v)
00379                                 return false;
00380                 }
00381                 else
00382                         v>>=1;
00383         }
00384 
00385         return true;
00386 }

double isValidDouble double  v  )  [inline]
 

Return true if double is a valid value (not inf nor nan)

Definition at line 186 of file common.h.

References v.

Referenced by NL3D::CLoadBalancingGroup::computeRatioAndSmooth().

00187 {
00188 #ifdef NL_OS_WINDOWS
00189         return _finite(v) && !_isnan(v);
00190 #else
00191         return !isnan(v) && !isinf(v);
00192 #endif
00193 }

void NLMISC::itoaInt64 sint64  number,
char *  str,
sint64  base = 10
 

Convert an sint64 into a string (same as itoa() function but for 64 bits intergers).

Definition at line 308 of file common.cpp.

References num, sint, sint64, and x.

00309 {
00310         str[0] = '\0';
00311         char b[256];
00312         if(!number)
00313         {
00314                 str[0] = '0';
00315                 str[1] = '\0';
00316                 return;
00317         }
00318         memset(b,'\0',255);
00319         memset(b,'0',64);
00320         sint n;
00321         sint64 x = number;
00322         if (x < 0) x = -x;
00323         char baseTable[] = "0123456789abcdefghijklmnopqrstuvwyz";
00324         for(n = 0; n < 64; n ++)
00325         {
00326                 sint num = (sint)(x % base);
00327                 b[64 - n] = baseTable[num];
00328                 if(!x) 
00329                 {
00330                         int k;
00331                         int j = 0;
00332         
00333                         if (number < 0)
00334                         {
00335                                 str[j++] = '-';
00336                         }
00337 
00338                         for(k = 64 - n + 1; k <= 64; k++)       
00339                         {
00340                                 str[j ++] = b[k];
00341                         }
00342                         str[j] = '\0';
00343                         break;
00344                 }
00345                 x /= base;
00346         }
00347 }

CStringConversion<TKey> KeyConversion stringTable  ,
sizeof(stringTable)/sizeof(stringTable[0])  ,
KeyCount 
[static]
 

Referenced by NLMISC::CEventKey::getKeyFromString(), and NLMISC::CEventKey::getStringFromKey().

bool NLMISC::killProgram uint32  pid  ) 
 

This function kill a program using his pid (on unix, it uses the kill() POSIX function).

Definition at line 677 of file common.cpp.

References nlwarning, res, and uint32.

Referenced by NLMISC_COMMAND().

00678 {
00679 #ifdef NL_OS_UNIX
00680         int res = kill(pid, SIGKILL);
00681         if(res == -1)
00682         {
00683                 char *err = strerror (errno);
00684                 nlwarning("Failed to kill '%d' err %d: '%s'", pid, errno, err);
00685         }
00686         return res == 0;
00687 /*#elif defined(NL_OS_WINDOWS)
00688         // it doesn't work because pid != handle and i don't know how to kill a pid or know the real handle of another service (not -1)
00689         int res = TerminateProcess((HANDLE)pid, 888);
00690         LPVOID lpMsgBuf;
00691         FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
00692         nlwarning("Failed to kill '%d' err %d: '%s'", pid, GetLastError (), lpMsgBuf);
00693         LocalFree(lpMsgBuf);
00694         return res != 0;
00695 */
00696 #else
00697         nlwarning("kill not implemented on this OS");
00698         return false;
00699 #endif
00700 }

bool NLMISC::launchProgram const std::string &  programName,
const std::string &  arguments
 

This function execute a program in the background and returns instantly (used for example to launch services in AES). The program will be launch in the current directory

Definition at line 702 of file common.cpp.

References nlassert, nldebug, nlwarning, res, uint, and uint32.

Referenced by NLMISC_COMMAND().

00703 {
00704 
00705 #ifdef NL_OS_WINDOWS
00706         STARTUPINFO         si;
00707     PROCESS_INFORMATION pi;
00708         
00709     memset(&si, 0, sizeof(si));
00710     memset(&pi, 0, sizeof(pi));
00711         
00712     si.cb = sizeof(si);
00713         
00714 /*      SECURITY_ATTRIBUTES sa;
00715         sa.nLength = sizeof (sa);
00716         sa.lpSecurityDescriptor = NULL;
00717         sa.bInheritHandle = FALSE;
00718 
00719         STARTUPINFO si;
00720         si.cb = sizeof (si);
00721         si.lpReserved = NULL;
00722         si.lpDesktop = NULL;
00723         si.lpTitle = NULL;
00724         si.dwFlags = STARTF_USESHOWWINDOW;
00725         si.cbReserved2 = 0;
00726         si.wShowWindow = SW_MINIMIZE;
00727         si.lpReserved2 = NULL;
00728 
00729         PROCESS_INFORMATION pi;
00730 */
00731         string arg = " " + arguments;
00732         BOOL res = CreateProcess(programName.c_str(), (char*)arg.c_str(), 0, 0, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, 0, 0, &si, &pi);
00733 
00734         if (res)
00735         {
00736                 nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
00737                 return true;
00738         }
00739         else
00740         {
00741                 LPVOID lpMsgBuf;
00742                 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
00743                 nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), GetLastError (), lpMsgBuf);
00744                 LocalFree(lpMsgBuf);
00745         }
00746 
00747 #elif defined(NL_OS_UNIX)
00748 
00749         static bool firstLaunchProgram = true;
00750         if (firstLaunchProgram)
00751         {
00752                 // The aim of this is to avoid defunct process.
00753                 //
00754                 // From "man signal":
00755                 //------
00756                 // According to POSIX (3.3.1.3) it is unspecified what happens when SIGCHLD is set to SIG_IGN.   Here
00757                 // the  BSD  and  SYSV  behaviours  differ,  causing BSD software that sets the action for SIGCHLD to
00758                 // SIG_IGN to fail on Linux.
00759                 //------
00760                 //
00761                 // But it works fine on my GNU/Linux so I do this because it's easier :) and I don't know exactly
00762                 // what to do to be portable.
00763                 signal(SIGCHLD,SIG_IGN);
00764                 
00765                 firstLaunchProgram = false;
00766         }
00767 
00768         int status = vfork ();
00769         if (status == -1)
00770         {
00771                 char *err = strerror (errno);
00772                 nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err);
00773         }
00774         else if (status == 0)
00775     {
00776                 // convert one arg into several args
00777                 vector<string> args;
00778                 char *argv[15];
00779                 
00780                 uint32 pos1 = 0, pos2 = 0;
00781                 
00782                 do
00783                 {
00784                         pos1 = arguments.find_first_not_of (" ", pos2);
00785                         if (pos1 == string::npos) break;
00786                         pos2 = arguments.find_first_of (" ", pos1);
00787                         args.push_back (arguments.substr (pos1, pos2-pos1));
00788                 }
00789                 while (pos2 != string::npos);
00790                 
00791                 nlassert (args.size() < 15);
00792                 
00793                 uint i = 0;
00794                 argv[i] = (char *)programName.c_str();
00795                 for (; i < args.size(); i++)
00796                 {
00797                         argv[i+1] = (char *) args[i].c_str();
00798                 }
00799                 argv[i+1] = NULL;
00800 
00801                 status = execvp(programName.c_str(), argv);
00802                 if (status == -1)
00803                 {
00804                         perror("Failed launched");
00805                         _exit(EXIT_FAILURE);
00806                 }
00807         }
00808         else
00809         {
00810                 nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
00811                 return true;
00812         }
00813 #else
00814         nlwarning ("LAUNCH: launchProgram() not implemented");
00815 #endif
00816 
00817         return false;
00818 
00819 }

template<class T>
T maxof const T &  a,
const T &  b,
const T &  c,
const T &  d,
const T &  e
[inline]
 

Definition at line 134 of file common.h.

References maxof().

00135         {return std::max(maxof(a,b,c,d),e);}

template<class T>
T maxof const T &  a,
const T &  b,
const T &  c,
const T &  d
[inline]
 

Definition at line 132 of file common.h.

References maxof().

00133         {return std::max(maxof(a,b,c),d);}

template<class T>
T maxof const T &  a,
const T &  b,
const T &  c
[inline]
 

Definition at line 130 of file common.h.

Referenced by NLMISC::CRGBA::convertToHLS(), and maxof().

00131         {return std::max(std::max(a,b),c);}

template<class T>
T minof const T &  a,
const T &  b,
const T &  c,
const T &  d,
const T &  e
[inline]
 

Definition at line 128 of file common.h.

References min, and minof().

00129         {return std::min(minof(a,b,c,d),e);}

template<class T>
T minof const T &  a,
const T &  b,
const T &  c,
const T &  d
[inline]
 

Definition at line 126 of file common.h.

References min, and minof().

00127         {return std::min(minof(a,b,c),d);}

template<class T>
T minof const T &  a,
const T &  b,
const T &  c
[inline]
 

MIN/MAX extended functions.

Definition at line 124 of file common.h.

References min.

Referenced by NLMISC::CRGBA::convertToHLS(), minof(), NLSOUND::CClusteredSound::update(), and NLMISC::CAABBoxExt::updateRadius().

00125         {return std::min(std::min(a,b),c);}

CPolygon2D::TVec2fVect::const_iterator Next const CPolygon2D::TVec2fVect::const_iterator &  it,
const CPolygon2D::TVec2fVect &  cont
[inline, static]
 

Definition at line 1057 of file polygon.cpp.

References nlassert, and NLMISC::CPolygon2D::TVec2fVect.

Referenced by NLMISC::CPolygon2D::computeBorders().

01058 {
01059         nlassert(cont.size() != 0);
01060         if ((it + 1) == cont.end()) return cont.begin();
01061         return (it + 1);
01062 }

NL_TRIVIAL_TYPE_TRAITS NL3D::CPlaneBasis   ) 
 

void NLMISC::nlError const char *  format,
... 
 

Never use this function but call the nlerror macro (internal use only).

Definition at line 134 of file debug.cpp.

References format, NLMISC_BREAKPOINT, and NLMISC_CONVERT_VARGS.

Referenced by NLNET::cbPacsAnswer().

00135 {
00136         char *str;
00137         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
00138 
00139         NLMISC::DebugNeedAssert = NLMISC::DefaultMsgBoxDisplayer==0;
00140 
00141         NLMISC::ErrorLog->displayNL (str);
00142 
00143         if (NLMISC::DebugNeedAssert)
00144                 NLMISC_BREAKPOINT;
00145 
00146 #ifndef NL_OS_WINDOWS
00147 //      exit(EXIT_FAILURE);
00148         abort ();
00149 #endif
00150 }

void NLMISC::nlFatalError const char *  format,
... 
 

Never use this function (internal use only).

Definition at line 115 of file debug.cpp.

References format, NLMISC_BREAKPOINT, and NLMISC_CONVERT_VARGS.

00116 {
00117         char *str;
00118         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
00119 
00120         NLMISC::DebugNeedAssert = NLMISC::DefaultMsgBoxDisplayer==0;
00121 
00122         NLMISC::ErrorLog->displayNL (str);
00123 
00124         if (NLMISC::DebugNeedAssert)
00125                 NLMISC_BREAKPOINT;
00126 
00127 #ifndef NL_OS_WINDOWS
00128         //      exit(EXIT_FAILURE);
00129         abort ();
00130 #endif
00131 
00132 }

int NLMISC::nlfseek64 FILE *  stream,
sint64  offset,
int  origin
 

Signed 64 bit fseek. Same interface than fseek

Definition at line 903 of file common.cpp.

References min, nlassert, offset, sint, sint64, and SINT64_CONSTANT.

Referenced by NLMISC::CBigFile::add(), NLMISC::CIFile::open(), NLMISC::COFile::seek(), and NLMISC::CIFile::seek().

00904 {
00905 #ifdef NL_OS_WINDOWS
00906         
00907         //
00908         fpos_t pos64 = 0;
00909         switch (origin)
00910         {
00911         case SEEK_CUR:
00912                 if (fgetpos(stream, &pos64) != 0)
00913                         return -1;
00914         case SEEK_END:
00915                 pos64 = _filelengthi64(_fileno(stream));
00916                 if (pos64 == -1L)
00917                         return -1;
00918         };
00919         
00920         // Seek
00921         pos64 += offset;
00922         
00923         // Set the final position
00924         return fsetpos (stream, &pos64);
00925         
00926 #else // NL_OS_WINDOWS
00927         
00928         // This code doesn't work under windows : fseek() implementation uses a signed 32 bits offset. What ever we do, it can't seek more than 2 Go.
00929         // For the moment, i don't know if it works under linux for seek of more than 2 Go.
00930         
00931         nlassert ((offset < SINT64_CONSTANT(2147483647)) && (offset > SINT64_CONSTANT(-2147483648)));
00932         
00933         bool first = true;
00934         do
00935         {
00936                 // Get the size of the next fseek
00937                 sint nextSeek;
00938                 if (offset > 0)
00939                         nextSeek = (sint)std::min (SINT64_CONSTANT(2147483647), offset);
00940                 else
00941                         nextSeek = (sint)std::max (-SINT64_CONSTANT(2147483648), offset);
00942                 
00943                 // Make a seek
00944                 int result = fseek ( stream, nextSeek, first?origin:SEEK_CUR );
00945                 if (result != 0)
00946                         return result;
00947                 
00948                 // Remaining
00949                 offset -= nextSeek;
00950                 first = false;
00951         }
00952         while (offset);
00953         
00954         return 0;
00955         
00956 #endif // NL_OS_WINDOWS
00957 }

NLMISC_COMMAND displayMeasures  ,
"display hierarchical timer"  ,
""  [depth]
 

Definition at line 1020 of file hierarchical_timer.cpp.

01021 {
01022         if (args.size() < 1)
01023         {
01024                 CHTimer::display(&log);
01025                 CHTimer::displayHierarchicalByExecutionPathSorted (&log, CHTimer::TotalTime, true, 64);
01026         }
01027         else
01028         {
01029                 CHTimer::displaySummary(&log, CHTimer::TotalTime, true, 64, 2, atoi(args[0].c_str()));
01030         }
01031 
01032         return true;
01033 }

NLMISC_COMMAND playerInfo  ,
"Get informations about a player or all players in CEntityIdTranslator"  ,
""  [< entityname >|< eid >|< username >|< uid >]
 

Definition at line 687 of file eid_translator.cpp.

References NLMISC::CEntityIdTranslator::getByEntity(), NLMISC::CEntityIdTranslator::getByUser(), NLMISC::CEntityIdTranslator::getEntityIdInfo(), NLMISC::CEntityIdTranslator::getRegisteredEntities(), res, NLMISC::CEntityId::setCreatorId(), NLMISC::CEntityId::setDynamicId(), sint16, sint8, ucstring::toString(), uint, and uint32.

00688 {
00689         if (args.size () == 0)
00690         {
00691                 const map<CEntityId, CEntityIdTranslator::CEntity>      &res = CEntityIdTranslator::getInstance()->getRegisteredEntities ();
00692                 log.displayNL("%d result(s) for 'all players informations'", res.size());
00693                 for (map<CEntityId, CEntityIdTranslator::CEntity>::const_iterator it = res.begin(); it != res.end(); it++)
00694                 {
00695                         log.displayNL("UId %d UserName '%s' EId %s EntityName '%s' EntitySlot %hd %s", (*it).second.UId, (*it).second.UserName.c_str(), (*it).first.toString().c_str(), (*it).second.EntityName.toString().c_str(), (sint16)((*it).second.EntitySlot), ((*it).second.Online?"Online":"Offline"));
00696                 }
00697 
00698                 return true;
00699         }
00700         else if (args.size () == 1)
00701         {
00702                 vector<CEntityId> res;
00703 
00704                 CEntityId eid (args[0].c_str());
00705                 uint32 uid = atoi (args[0].c_str());
00706 
00707                 if (eid != CEntityId::Unknown)
00708                 {
00709                         // we have to remove the crea and dyna because it can changed dynamically and will not be found in the storage array
00710                         eid.setCreatorId(0);
00711                         eid.setDynamicId(0);
00712                         
00713                         res.push_back(eid);
00714                 }
00715                 else if (uid != 0)
00716                 {
00717                         // the parameter is an uid
00718                         CEntityIdTranslator::getInstance()->getByUser (uid, res);
00719                 }
00720                 else
00721                 {
00722                         CEntityIdTranslator::getInstance()->getByUser (args[0], res, false);
00723                         
00724                         CEntityIdTranslator::getInstance()->getByEntity (args[0], res, false);
00725                 }
00726                 
00727                 log.displayNL("%d result(s) for '%s'", res.size(), args[0].c_str());
00728                 for (uint i = 0; i < res.size(); i++)
00729                 {
00730                         ucstring entityName;
00731                         sint8 entitySlot;
00732                         uint32 uid2;
00733                         string userName;
00734                         bool online;
00735                         CEntityIdTranslator::getInstance()->getEntityIdInfo (res[i], entityName, entitySlot, uid2, userName, online);
00736 
00737                         log.displayNL("UId %d UserName '%s' EId %s EntityName '%s' EntitySlot %hd %s", uid2, userName.c_str(), res[i].toString().c_str(), entityName.toString().c_str(), (sint16)entitySlot, (online?"Online":"Offline"));
00738                 }
00739 
00740                 return true;
00741         }
00742 
00743         return false;
00744 }

NLMISC_COMMAND entityNameValid  ,
"Tell if an entity name is valid or not using CEntityIdTranslator validation rulez"  ,
"< entityname >" 
 

Definition at line 664 of file eid_translator.cpp.

References NLMISC::CEntityIdTranslator::entityNameExists(), and NLMISC::CEntityIdTranslator::isValidEntityName().

00665 {
00666         if (args.size () != 1) return false;
00667 
00668         if(!CEntityIdTranslator::getInstance()->isValidEntityName(args[0], &log))
00669         {
00670                 log.displayNL("Entity name '%s' is not valid", args[0].c_str());
00671         }
00672         else
00673         {
00674                 if (CEntityIdTranslator::getInstance()->entityNameExists(args[0]))
00675                 {
00676                         log.displayNL("Entity name '%s' is already used by another player", args[0].c_str());
00677                 }
00678                 else
00679                 {
00680                         log.displayNL("Entity name '%s' is available", args[0].c_str());
00681                 }
00682         }
00683 
00684         return true;
00685 }

NLMISC_COMMAND findEIdByEntity  ,
"Find entity id using the entity name"  ,
"< entityname >|< eid >" 
 

Definition at line 633 of file eid_translator.cpp.

References NLMISC::CEntityIdTranslator::getByEntity(), NLMISC::CEntityIdTranslator::getEntityIdInfo(), sint16, sint8, ucstring::toString(), NLMISC::CEntityId::toString(), and uint32.

00634 {
00635         if (args.size () != 1)
00636                 return false;
00637         
00638         CEntityId eid (args[0].c_str());
00639 
00640         if (eid == CEntityId::Unknown)
00641         {
00642                 eid = CEntityIdTranslator::getInstance()->getByEntity(args[0]);
00643         }
00644 
00645         if (eid == CEntityId::Unknown)
00646         {
00647                 log.displayNL("'%s' is not an eid or an entity name", args[0].c_str());
00648                 return false;
00649         }
00650 
00651         ucstring entityName;
00652         sint8 entitySlot;
00653         uint32 uid;
00654         string userName;
00655         bool online;
00656 
00657         CEntityIdTranslator::getInstance()->getEntityIdInfo(eid, entityName, entitySlot, uid, userName, online);
00658 
00659         log.displayNL("UId %d UserName '%s' EId %s EntityName '%s' EntitySlot %hd %s", uid, userName.c_str(), eid.toString().c_str(), entityName.toString().c_str(), (sint16)entitySlot, (online?"Online":"Offline"));
00660         
00661         return true;
00662 }

NLMISC_COMMAND findEIdByUser  ,
"Find entity ids using the user name"  ,
"< username >|< uid >" 
 

Definition at line 603 of file eid_translator.cpp.

References NLMISC::CEntityIdTranslator::getByUser(), NLMISC::CEntityIdTranslator::getUId(), NLMISC::CEntityIdTranslator::getUserName(), res, toString(), uint, and uint32.

00604 {
00605         if (args.size () != 1)
00606                 return false;
00607 
00608         vector<CEntityId> res;
00609 
00610         string userName = args[0];
00611         uint32 uid = atoi (userName.c_str());
00612 
00613         if (uid != 0)
00614         {
00615                 CEntityIdTranslator::getInstance()->getByUser(uid, res);
00616                 userName = CEntityIdTranslator::getInstance()->getUserName(uid);
00617         }
00618         else
00619         {
00620                 CEntityIdTranslator::getInstance()->getByUser(userName, res);
00621                 CEntityIdTranslator::getInstance()->getUId(userName);
00622         }
00623         
00624         log.displayNL("User Name '%s' (uid=%d) has %d entities:", userName.c_str(), uid, res.size());
00625         for (uint i = 0 ; i < res.size(); i++)
00626         {
00627                 log.displayNL(">  %s %s", res[i].toString().c_str(), CEntityIdTranslator::getInstance()->getByEntity (res[i]).c_str());
00628         }
00629         
00630         return true;
00631 }

NLMISC_COMMAND readaccess  ,
"read a uint8 value in an invalid address ,
""  [< adr >]
 

Definition at line 1194 of file debug.cpp.

References uint16, uint64, and uint8.

01195 {
01196         uint8 val;
01197         uint8 *adr = (uint8*)0;
01198         if(args.size() == 1)
01199 #ifdef HAVE_X86_64
01200           adr = (uint8*)(uint64)atoi(args[0].c_str());
01201 #else
01202           adr = (uint8*)atoi(args[0].c_str());
01203 #endif
01204         val = *adr;
01205         log.displayNL("value is %hu", (uint16)val);
01206         return true;
01207 }

NLMISC_COMMAND writeaccess  ,
"write a uint8 value in an invalid address ,
"]"  [< adr >[< value >]
 

Definition at line 1179 of file debug.cpp.

References uint64, and uint8.

01180 {
01181         uint8 val = 123;
01182         uint8 *adr = (uint8*)0;
01183         if(args.size() >= 1)
01184 #ifdef HAVE_X86_64
01185           adr = (uint8*)(uint64)atoi(args[0].c_str());
01186 #else
01187           adr = (uint8*)atoi(args[0].c_str());
01188 #endif
01189         if(args.size() >= 2) val = (uint8)atoi(args[1].c_str());
01190         *adr = val;
01191         return true;
01192 }

NLMISC_COMMAND divbyzero  ,
"generate a divide by zero"  ,
"" 
 

Definition at line 1171 of file debug.cpp.

01172 {
01173         if(args.size() != 0) return false;
01174         float a=10,b=0;
01175         a /= b;
01176         return true;
01177 }

NLMISC_COMMAND abort  ,
"generate a abort()"  ,
"" 
 

Definition at line 1164 of file debug.cpp.

01165 {
01166         if(args.size() != 0) return false;
01167         abort();
01168         return true;
01169 }

NLMISC_COMMAND stop  ,
"generate a nlstop()"  ,
"" 
 

Definition at line 1157 of file debug.cpp.

References nlstopex.

01158 {
01159         if(args.size() != 0) return false;
01160         nlstopex (("Stop generated by the stop command"));
01161         return true;
01162 }

NLMISC_COMMAND assert  ,
"generate a failed nlassert()"  ,
"" 
 

Definition at line 1150 of file debug.cpp.

References nlassertex.

01151 {
01152         if(args.size() != 0) return false;
01153         nlassertex (false, ("Assert generated by the assert command"));
01154         return true;
01155 }

NLMISC_COMMAND displayFilterWarning  ,
"display filter on WarningLog"  ,
"" 
 

Definition at line 1141 of file debug.cpp.

References NLMISC::CLog::displayFilter(), and WarningLog.

01142 {
01143         if(args.size() != 0) return false;
01144         WarningLog->displayFilter(log);
01145         return true;
01146 }

NLMISC_COMMAND removeFilterWarning  ,
"remove a filter on WarningLog"  ,
""  [< filterstr >]
 

Definition at line 1131 of file debug.cpp.

References NLMISC::CLog::removeFilter(), and WarningLog.

01132 {
01133         if(args.size() == 0)
01134                 WarningLog->removeFilter();
01135         else if(args.size() == 1)
01136                 WarningLog->removeFilter( args[0].c_str() );
01137         else return false;
01138         return true;
01139 }

NLMISC_COMMAND addNegativeFilterWarning  ,
"add a negative filter on WarningLog"  ,
"< filterstr >" 
 

Definition at line 1124 of file debug.cpp.

References NLMISC::CLog::addNegativeFilter(), and WarningLog.

01125 {
01126         if(args.size() != 1) return false;
01127         WarningLog->addNegativeFilter( args[0].c_str() );
01128         return true;
01129 }

NLMISC_COMMAND addPositiveFilterWarning  ,
"add a positive filter on WarningLog"  ,
"< filterstr >" 
 

Definition at line 1117 of file debug.cpp.

References NLMISC::CLog::addPositiveFilter(), and WarningLog.

01118 {
01119         if(args.size() != 1) return false;
01120         WarningLog->addPositiveFilter( args[0].c_str() );
01121         return true;
01122 }

NLMISC_COMMAND displayFilterInfo  ,
"display filter on InfoLog"  ,
""  [d|i|w|e]
 

Definition at line 1094 of file debug.cpp.

References DebugLog, NLMISC::CLog::displayFilter(), ErrorLog, InfoLog, and WarningLog.

01095 {
01096         if(args.size() > 1) return false;
01097         if ( args.size() == 1 )
01098         {
01099                 if ( strcmp( args[0].c_str(), "d" ) == 0 )
01100                         InfoLog->displayFilter(*DebugLog);
01101                 else if ( strcmp( args[0].c_str(), "i" ) == 0 )
01102                         InfoLog->displayFilter(*InfoLog);
01103                 else if ( strcmp( args[0].c_str(), "w" ) == 0 )
01104                         InfoLog->displayFilter(*WarningLog);
01105                 else if ( strcmp( args[0].c_str(), "e" ) == 0 )
01106                         InfoLog->displayFilter(*ErrorLog);
01107                 else
01108                         return false;
01109         }
01110         else
01111         {
01112                 InfoLog->displayFilter(log);
01113         }
01114         return true;
01115 }

NLMISC_COMMAND removeFilterInfo  ,
"remove a filter on InfoLog"  ,
""  [< filterstr >]
 

Definition at line 1084 of file debug.cpp.

References InfoLog, and NLMISC::CLog::removeFilter().

01085 {
01086         if(args.size() == 0)
01087                 InfoLog->removeFilter();
01088         else if(args.size() == 1)
01089                 InfoLog->removeFilter( args[0].c_str() );
01090         else return false;
01091         return true;
01092 }

NLMISC_COMMAND addNegativeFilterInfo  ,
"add a negative filter on InfoLog"  ,
"< filterstr >" 
 

Definition at line 1077 of file debug.cpp.

References NLMISC::CLog::addNegativeFilter(), and InfoLog.

01078 {
01079         if(args.size() != 1) return false;
01080         InfoLog->addNegativeFilter( args[0].c_str() );
01081         return true;
01082 }

NLMISC_COMMAND addPositiveFilterInfo  ,
"add a positive filter on InfoLog"  ,
"< filterstr >" 
 

Definition at line 1070 of file debug.cpp.

References NLMISC::CLog::addPositiveFilter(), and InfoLog.

01071 {
01072         if(args.size() != 1) return false;
01073         InfoLog->addPositiveFilter( args[0].c_str() );
01074         return true;
01075 }

NLMISC_COMMAND displayFilterDebug  ,
"display filter on DebugLog"  ,
"" 
 

Definition at line 1063 of file debug.cpp.

References DebugLog, and NLMISC::CLog::displayFilter().

01064 {
01065         if(args.size() != 0) return false;
01066         DebugLog->displayFilter(log);
01067         return true;
01068 }

NLMISC_COMMAND removeFilterDebug  ,
"remove a filter on DebugLog"  ,
""  [< filterstr >]
 

Definition at line 1053 of file debug.cpp.

References DebugLog, and NLMISC::CLog::removeFilter().

01054 {
01055         if(args.size() == 0)
01056                 DebugLog->removeFilter();
01057         else if(args.size() == 1)
01058                 DebugLog->removeFilter( args[0].c_str() );
01059         else return false;
01060         return true;
01061 }

NLMISC_COMMAND addNegativeFilterDebug  ,
"add a negative filter on DebugLog"  ,
"< filterstr >" 
 

Definition at line 1046 of file debug.cpp.

References NLMISC::CLog::addNegativeFilter(), and DebugLog.

01047 {
01048         if(args.size() != 1) return false;
01049         DebugLog->addNegativeFilter( args[0].c_str() );
01050         return true;
01051 }

NLMISC_COMMAND addPositiveFilterDebug  ,
"add a positive filter on DebugLog"  ,
"< filterstr >" 
 

Definition at line 1039 of file debug.cpp.

References NLMISC::CLog::addPositiveFilter(), and DebugLog.

01040 {
01041         if(args.size() != 1) return false;
01042         DebugLog->addPositiveFilter( args[0].c_str() );
01043         return true;
01044 }

NLMISC_COMMAND resetFilters  ,
"disable all filters on Nel loggers"  ,
""  [debug|info|warning|error|assert]
 

Definition at line 1013 of file debug.cpp.

References AssertLog, DebugLog, ErrorLog, InfoLog, NLMISC::CLog::resetFilters(), and WarningLog.

01014 {
01015         if(args.size() == 0)
01016         {
01017                 DebugLog->resetFilters();
01018                 InfoLog->resetFilters();
01019                 WarningLog->resetFilters();
01020                 ErrorLog->resetFilters();
01021                 AssertLog->resetFilters();
01022         }
01023         else if (args.size() == 1)
01024         {
01025                 if (args[0] == "debug") DebugLog->resetFilters();
01026                 else if (args[0] == "info") InfoLog->resetFilters();
01027                 else if (args[0] == "warning") WarningLog->resetFilters();
01028                 else if (args[0] == "error") ErrorLog->resetFilters();
01029                 else if (args[0] == "assert") AssertLog->resetFilters();
01030         }
01031         else
01032         {
01033                 return false;
01034         }
01035 
01036         return true;
01037 }

NLMISC_COMMAND displayMemlog  ,
"displays the last N line of the log in memory"  ,
""  [< NbLines >]
 

Definition at line 986 of file debug.cpp.

References DefaultMemDisplayer, NLMISC::CMemDisplayer::lockStrings(), uint, NLMISC::CMemDisplayer::unlockStrings(), and NLMISC::CMemDisplayer::write().

00987 {
00988         uint nbLines;
00989 
00990         if (args.size() == 0) nbLines = 100;
00991         else if (args.size() == 1) nbLines = atoi(args[0].c_str());
00992         else return false;
00993 
00994         if (DefaultMemDisplayer == NULL) return false;
00995 
00996         deque<string>::const_iterator it;
00997         
00998         const deque<string> &str = DefaultMemDisplayer->lockStrings ();
00999 
01000         if (nbLines >= str.size())
01001                 it = str.begin();
01002         else
01003                 it = str.end() - nbLines;
01004 
01005         DefaultMemDisplayer->write (&log);
01006 
01007         DefaultMemDisplayer->unlockStrings ();
01008 
01009         return true;
01010 }

NLMISC_COMMAND killProgram  ,
"kill a program given the pid"  ,
"< pid >" 
 

Definition at line 1002 of file common.cpp.

References killProgram().

01003 {
01004         if(args.size() != 1) return false;
01005         killProgram(atoi(args[0].c_str()));
01006         return true;
01007 }

NLMISC_COMMAND launchProgram  ,
"Execute the command line using launcProgram() function call(launch in background task without waiting the end of the execution)"  ,
"< programName >< arguments >" 
 

Definition at line 990 of file common.cpp.

References launchProgram().

00991 {
00992         if(args.size() != 2) return false;
00993         
00994         string cmd = args[0];
00995         string arg = args[1];
00996         log.displayNL ("Executing '%s' with argument '%s'", cmd.c_str(), arg.c_str());
00997         launchProgram(cmd, arg);
00998         log.displayNL ("End of Execution of '%s' with argument '%s'", cmd.c_str(), arg.c_str());
00999         return true;
01000 }

NLMISC_COMMAND system  ,
"Execute the command line using system() function call(wait until the end of the command)"  ,
"< commandline >" 
 

Definition at line 979 of file common.cpp.

00980 {
00981         if(args.size() != 1) return false;
00982         
00983         string cmd = args[0];
00984         log.displayNL ("Executing '%s'", cmd.c_str());
00985         system(cmd.c_str());
00986         log.displayNL ("End of Execution of '%s'", cmd.c_str());
00987         return true;
00988 }

NLMISC_COMMAND sleep  ,
"Freeze the service for N seconds(for debug purpose)"  ,
"< N >" 
 

Commands

Definition at line 967 of file common.cpp.

References nlSleep(), and sint32.

00968 {
00969         if(args.size() != 1) return false;
00970         
00971         sint32 n = atoi (args[0].c_str());
00972         
00973         log.displayNL ("Sleeping during %d seconds", n);
00974         
00975         nlSleep(n * 1000);      
00976         return true;
00977 }

NLMISC_COMMAND stohr  ,
"Convert a second number into an human readable time"  ,
"< int >" 
 

Definition at line 526 of file common.cpp.

References secondsToHumanReadable().

00527 {
00528         if (args.size() != 1)
00529                 return false;
00530         
00531         log.displayNL("%s -> %s", args[0].c_str(), secondsToHumanReadable(atoi(args[0].c_str())).c_str());
00532         
00533         return true;
00534 }

NLMISC_COMMAND hrtob  ,
"Convert a human readable number into a bytes number"  ,
"< hr >" 
 

Definition at line 465 of file common.cpp.

References humanReadableToBytes().

00466 {
00467         if (args.size() != 1)
00468                 return false;
00469         
00470         log.displayNL("%s -> %u", args[0].c_str(), humanReadableToBytes(args[0]));
00471         
00472         return true;
00473 }

NLMISC_COMMAND btohr  ,
"Convert a bytes number into an human readable number"  ,
"< int >" 
 

Definition at line 454 of file common.cpp.

References bytesToHumanReadable().

00455 {
00456         if (args.size() != 1)
00457                 return false;
00458         
00459         log.displayNL("%s -> %s", args[0].c_str(), bytesToHumanReadable(args[0]).c_str());
00460 
00461         return true;
00462 }

NLMISC_COMMAND help  ,
"display help on a specific variable/commands or on all variables and commands"  ,
""  [< variable >|< command >]
 

Definition at line 389 of file command.cpp.

References nlassert, and uint.

00390 {       
00391         nlassert (Commands != NULL);
00392         
00393         if (args.size() == 0)
00394         {
00395                 // display all commands
00396                 log.displayNL("There's %d variables and commands: ", (*Commands).size());
00397                 uint i = 0;
00398                 for (TCommand::iterator comm = (*Commands).begin(); comm != (*Commands).end(); comm++, i++)
00399                 {
00400                         log.displayNL("%2d %-15s: %s", i, (*comm).first.c_str(), (*comm).second->HelpString.c_str());
00401                 }
00402         }
00403         else if (args.size() == 1)
00404         {
00405                 // display help of the command
00406                 TCommand::iterator comm = (*Commands).find(args[0].c_str());
00407                 if (comm == (*Commands).end ())
00408                 {
00409                         log.displayNL("command '%s' not found", args[0].c_str());
00410                 }
00411                 else
00412                 {
00413                         log.displayNL("%s", (*comm).second->HelpString.c_str());
00414                         log.displayNL("usage: %s %s", (*comm).first.c_str(), (*comm).second->CommandArgs.c_str(), (*comm).second->HelpString.c_str());
00415                 }
00416         }
00417         else
00418         {
00419                 return false;
00420         }
00421         return true;
00422 }

NLMISC_DYNVARIABLE string  ,
OS  ,
"OS used" 
 

Definition at line 721 of file system_info.cpp.

References pointer.

00722 {
00723         if (get) *pointer = CSystemInfo::getOS();
00724 }

NLMISC_DYNVARIABLE string  ,
ProcessUsedMemory  ,
"Memory used by this process in bytes" 
 

Definition at line 716 of file system_info.cpp.

References bytesToHumanReadable(), and pointer.

00717 {
00718         if (get) *pointer = bytesToHumanReadable(CHeapAllocator::getAllocatedSystemMemory ());
00719 }

NLMISC_DYNVARIABLE string  ,
TotalPhysicalMemory  ,
"Total physical memory on this computer in bytes" 
 

Definition at line 711 of file system_info.cpp.

References bytesToHumanReadable(), and pointer.

00712 {
00713         if (get) *pointer = bytesToHumanReadable(CSystemInfo::totalPhysicalMemory ());
00714 }

NLMISC_DYNVARIABLE string  ,
AvailablePhysicalMemory  ,
"Physical memory available on this computer in bytes" 
 

Definition at line 706 of file system_info.cpp.

References bytesToHumanReadable(), and pointer.

00707 {
00708         if (get) *pointer = bytesToHumanReadable(CSystemInfo::availablePhysicalMemory ());
00709 }

void NLMISC::nlSleep uint32  ms  ) 
 

Portable Sleep() function that suspends the execution of the calling thread for a number of milliseconds. Note: the resolution of the timer is system-dependant and may be more than 1 millisecond.

Definition at line 73 of file common.cpp.

References uint32.

Referenced by NLNET::CCallbackNetBase::baseUpdate(), NLNET::CLoginClient::connectToShard(), NLMISC::CSystemInfo::getProcessorFrequency(), NL3D::CZoneLighter::light(), NL3D::CZoneLighter::lightShapes(), NL3D::CLandscapeUser::loadAllZonesAround(), NLMISC::CIFile::loadIntoCache(), NLNET::IService::main(), NLMISC_COMMAND(), NLNET::CNamingClient::queryServicePort(), NL3D::CLandscapeUser::refreshAllZonesAround(), NLPACS::CGlobalRetriever::refreshLrAroundNow(), NLNET::CNamingClient::registerService(), NLNET::CNamingClient::registerServiceWithSId(), CTimeoutAssertionThread::run(), NLNET::CServerReceiveTask::run(), NLAIAGENT::CAgentManagerTimer::CRunTimer::run(), NLMISC::CIFile::serialBuffer(), NLMISC::CTaskManager::sleepTask(), NL3D::UInstanceGroup::stopCreateInstanceGroupAsync(), NLNET::CUnifiedNetwork::update(), NLNET::CNetManager::update(), NLSOUND::CSampleBank::~CSampleBank(), and NLMISC::CTaskManager::~CTaskManager().

00074 {
00075 #ifdef NL_OS_WINDOWS
00076 
00078 #ifdef NL_DEBUG
00079         ms = max(ms, (uint32)1);
00080 #endif
00081 
00082         Sleep( ms );
00083 
00084 #elif defined NL_OS_UNIX
00085         usleep( ms*1000 );
00086 #endif
00087 }

sint nlstricmp const char *  lhs,
const std::string &  rhs
[inline]
 

Definition at line 231 of file common.h.

References sint, and stricmp().

00231 { return stricmp(lhs,rhs.c_str()); }

sint nlstricmp const std::string &  lhs,
const char *  rhs
[inline]
 

Definition at line 230 of file common.h.

References sint, and stricmp().

00230 { return stricmp(lhs.c_str(),rhs); }

sint nlstricmp const std::string &  lhs,
const std::string &  rhs
[inline]
 

Definition at line 229 of file common.h.

References sint, and stricmp().

00229 { return stricmp(lhs.c_str(), rhs.c_str()); }

sint nlstricmp const char *  lhs,
const char *  rhs
[inline]
 

Definition at line 228 of file common.h.

References sint, and stricmp().

Referenced by NLGEORGES::CMyEvalNumExpr::evalValue(), and NLMISC::CUnsensitiveStrLessPred::operator()().

00228 { return stricmp(lhs, rhs); }

CVectorD operator * double  f,
const CVectorD &  v
[inline]
 

Definition at line 88 of file vectord_inline.h.

References v.

00089 {
00090         CVectorD        ret(v.x*f, v.y*f, v.z*f);
00091         return ret;
00092 }

CVector operator * float  f,
const CVector &  v
[inline]
 

Definition at line 88 of file vector_inline.h.

References v.

00089 {
00090         CVector ret(v.x*f, v.y*f, v.z*f);
00091         return ret;
00092 }

CVector2f operator * float  f,
const CVector2f &  v
[inline]
 

Definition at line 140 of file vector_2f.h.

References v.

00141 {
00142         return v*f;
00143 }

CVector2d operator * double  f,
const CVector2d &  v
[inline]
 

Definition at line 134 of file vector_2d.h.

References v.

00135 {
00136         return v*f;
00137 }

CUV operator * const CUV &  uv,
float  f
[inline]
 

Definition at line 92 of file uv.h.

00093 {
00094         return f * uv;
00095 }

CUV operator * float  f,
const CUV &  uv
[inline]
 

Definition at line 86 of file uv.h.

References NLMISC::CUV::U, and NLMISC::CUV::V.

00087 {
00088         return CUV(uv.U * f, uv.V * f);
00089 }

CRGBAF operator * float  f,
const CRGBAF &  c
[inline]
 

Mul float operator. Multiplate each component by f.

Parameters:
f Float factor.
Returns:
Return the result

Definition at line 669 of file rgba.h.

References NLMISC::CRGBAF::A, NLMISC::CRGBAF::B, NLMISC::CRGBAF::G, and NLMISC::CRGBAF::R.

00670 {
00671         return CRGBAF (c.R*f, c.G*f, c.B*f, c.A*f);
00672 }

template<class T>
CQuatT<T> operator * f,
const CQuatT< T > &  o
[inline]
 

f*quat operator

Definition at line 211 of file quat.h.

00211 {return o*f;}

CPlane operator * const CPlane &  p,
const CMatrix m
 

Definition at line 1308 of file matrix.cpp.

References NLMISC::CPlane::a, NLMISC::CPlane::b, NLMISC::CPlane::c, NLMISC::CPlane::d, MAT_PROJ, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, MAT_TRANS, NLMISC::CMatrix::StateBit, NLMISC::CMatrix::testExpandProj(), and NLMISC::CMatrix::testExpandRot().

01309 {
01310         // \todo yoyo: TODO_OPTIMIZE it...
01311         m.testExpandRot();
01312         m.testExpandProj();
01313 
01314 
01315         CPlane  ret;
01316 
01317         if( m.StateBit & (MAT_ROT|MAT_SCALEUNI|MAT_SCALEANY|MAT_PROJ) )
01318         {
01319                 // Compose with translation too.
01320                 ret.a= p.a*m.a11 + p.b*m.a21 + p.c*m.a31 + p.d*m.a41;
01321                 ret.b= p.a*m.a12 + p.b*m.a22 + p.c*m.a32 + p.d*m.a42;
01322                 ret.c= p.a*m.a13 + p.b*m.a23 + p.c*m.a33 + p.d*m.a43;
01323                 ret.d= p.a*m.a14 + p.b*m.a24 + p.c*m.a34 + p.d*m.a44;
01324                 return ret;
01325         }
01326         else if( m.StateBit & MAT_TRANS )
01327         {
01328 
01329                 // Compose just with a translation.
01330                 ret.a= p.a;
01331                 ret.b= p.b;
01332                 ret.c= p.c;
01333                 ret.d= p.a*m.a14 + p.b*m.a24 + p.c*m.a34 + p.d*m.a44;
01334                 return ret;
01335         }
01336         else    // Identity!!
01337                 return p;
01338 }

bool operator!= const CGameDeviceDesc &  lhs,
const CGameDeviceDesc &  rhs
[inline]
 

Definition at line 60 of file game_device.h.

00061 {
00062         return !(lhs == rhs);
00063 }

bool operator< const CVector2f &  lhs,
const CVector2f &  rhs
[inline]
 

Definition at line 146 of file vector_2f.h.

References NLMISC::CVector2f::x, and NLMISC::CVector2f::y.

00147 {
00148         return (lhs.x != rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y;        
00149 }

bool NLMISC::operator< const CPolygon2D &  lhs,
const CPolygon2D &  rhs
 

Definition at line 1945 of file polygon.cpp.

References uint, and NLMISC::CPolygon2D::Vertices.

01946 {
01947         if (lhs.Vertices.size() != rhs.Vertices.size()) return lhs.Vertices.size() < rhs.Vertices.size();
01948         for(uint k = 0; k < lhs.Vertices.size(); ++k)
01949         {
01950                 if (lhs.Vertices[k] != rhs.Vertices[k]) return lhs.Vertices[k] < rhs.Vertices[k];
01951         }
01952         return false;
01953 }

bool operator== const CGameDeviceDesc &  lhs,
const CGameDeviceDesc &  rhs
[inline]
 

for devices comparison. The 'Connected' field is ignored.

Definition at line 55 of file game_device.h.

References NLMISC::CGameDeviceDesc::InstanceName, and NLMISC::CGameDeviceDesc::ProductName.

00056 {
00057         return lhs.InstanceName == rhs.InstanceName && lhs.ProductName == rhs.ProductName;
00058 }

bool NLMISC::operator== const CPolygon2D &  lhs,
const CPolygon2D &  rhs
 

Definition at line 1938 of file polygon.cpp.

References NLMISC::CPolygon2D::Vertices.

01939 {
01940         if (lhs.Vertices.size() != rhs.Vertices.size()) return false;
01941         return std::equal(lhs.Vertices.begin(), lhs.Vertices.end(), rhs.Vertices.begin());
01942 }

sint OptFastFloor float  x  )  [inline]
 

Definition at line 125 of file fast_floor.h.

References sint, and x.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CPatch::appendTileLightInfluences(), NL3D::CHLSColorTexture::compressBlockRGB(), NL3D::computeLodLighting(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NLMISC::CNoiseColorGradient::eval(), NLMISC::CRandomGrid3D::evalBiLinear(), NLMISC::CRandomGrid3D::evalNearest(), NL3D::CVegetable::generateGroupEx(), NL3D::CPatch::generateTileVegetable(), NL3D::CPatch::getLumel(), NL3D::CSurfaceLightGrid::getStaticLightSetup(), NL3D::CPatch::getTileElement(), NL3D::CTessFacePriorityList::insert(), NL3D::CClipTrav::loadBalanceSkeletonCLod(), NL3D::CSpinnerFunctor::operator()(), NL3D::CPSFloatCurveFunctor::operator()(), NL3D::CPSValueGradientFunc< sint32 >::operator()(), NL3D::CPSValueBlendSampleFunc< NLMISC::CRGBA, n >::operator()(), NL3D::CMeshBlender::prepareRenderForGlobalAlphaCoarseMesh(), NL3D::CVegetableManager::render(), NL3D::CMeshMRMSkinnedGeom::render(), NL3D::CMeshMRMGeom::render(), NL3D::CMeshGeom::render(), NL3D::CShadowMapManager::renderProject(), NL3D::CRenderTrav::traverse(), and NL3D::CTransform::traverseLight().

00126 {
00127         return (sint)floor(x);
00128 }

uint32 OptFastFloor24 float  x  )  [inline]
 

Definition at line 138 of file fast_floor.h.

References uint32, and x.

Referenced by NL3D::CPatchDLMContext::addPointLightInfluence().

00139 {
00140         return (uint32)floor(x);
00141 }

void OptFastFloorBegin  )  [inline]
 

Definition at line 123 of file fast_floor.h.

Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSAttribMakerT< T, F >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN(), NL3D::CLandscape::refine(), NL3D::CRenderTrav::traverse(), and NL3D::CLandscape::updateLightingAll().

00123 {}

void OptFastFloorBegin24  )  [inline]
 

Definition at line 136 of file fast_floor.h.

Referenced by NL3D::CPatchDLMContext::addPointLightInfluence().

00136 {}

void OptFastFloorEnd  )  [inline]
 

Definition at line 124 of file fast_floor.h.

Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSAttribMakerT< T, F >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::get(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN(), NL3D::CLandscape::refine(), NL3D::CRenderTrav::traverse(), and NL3D::CLandscape::updateLightingAll().

00124 {}

void OptFastFloorEnd24  )  [inline]
 

Definition at line 137 of file fast_floor.h.

Referenced by NL3D::CPatchDLMContext::addPointLightInfluence().

00137 {}

float OptFastFractionnalPart float  x  )  [inline]
 

Definition at line 130 of file fast_floor.h.

References sint, and x.

00131 {
00132         return x - (sint) x ;
00133 }

CPolygon2D::TVec2fVect::const_iterator Prev const CPolygon2D::TVec2fVect::const_iterator &  it,
const CPolygon2D::TVec2fVect &  cont
[inline, static]
 

Definition at line 1067 of file polygon.cpp.

References nlassert, and NLMISC::CPolygon2D::TVec2fVect.

Referenced by NLMISC::CPolygon2D::computeBorders().

01068 {
01069         nlassert(cont.size() != 0);
01070         if (it == cont.begin()) return cont.end() - 1;
01071         return (it - 1);
01072 }

float radToDeg float  rad  )  [inline]
 

Converts from radians to degrees

Definition at line 178 of file common.h.

References Pi.

Referenced by NLSOUND::CSourceAL::setCone().

00179 {
00180         return rad * 180.0f / (float)Pi;
00181 }

uint NLMISC::raiseToNextPowerOf2 uint  v  ) 
 

Return the value maximized to the next power of 2 of v. Example: raiseToNextPowerOf2(8) is 8 raiseToNextPowerOf2(5) is 8

Definition at line 349 of file common.cpp.

References res, uint, and v.

Referenced by NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CIGSurfaceLightBuild::buildPLDebugMesh(), NL3D::CDeform2d::doDeform(), NL3D::CTextureGrouped::doGenerate(), NL3D::CNoise3d::init(), NL3D::SCloudTextureClamp::init(), NL3D::SCloudTexture3D::init(), NL3D::CCloud::init(), NL3D::CShadowMap::initTexture(), NL3D::CCloudScape::makeHalfCloud(), NL3D::CMotionBlur::performMotionBlur(), NL3D::CShadowMapManager::renderGenerate(), NL3D::CScene::setShadowMapTextureSize(), and NL3D::CDeform2d::setupBuffer().

00350 {
00351         uint    res=1;
00352         while(res<v)
00353                 res<<=1;
00354         
00355         return res;
00356 }

void removeAllUnusedChar string &  str  )  [static]
 

Definition at line 280 of file path.cpp.

References uint32.

Referenced by NLMISC::CPath::loadRemappedFiles().

00281 {
00282         uint32 i = 0;
00283         while (!str.empty() && (i != str.size()))
00284         {
00285                 if ((str[i] == ' ' || str[i] == '\t' || str[i] == '\r' || str[i] == '\n'))
00286                         str.erase(str.begin()+i);
00287                 else
00288                         i++;
00289         }
00290 }

std::string NLMISC::removeSlashR std::string  str  ) 
 

Definition at line 50 of file string_common.cpp.

References uint.

00051 {
00052         string formatedStr;
00053         // replace \n with \r\n
00054         for (uint i = 0; i < str.size(); i++)
00055         {
00056                 if (str[i] != '\r')
00057                         formatedStr += str[i];
00058         }
00059         return formatedStr;
00060 }

TReportResult report const std::string &  title,
const std::string &  header,
const std::string &  subject,
const std::string &  body,
bool  enableCheckIgnore,
uint  debugButton,
bool  ignoreButton,
sint  quitButton,
bool  sendReportButton,
bool &  ignoreNextTime
 

void report  ) 
 

Definition at line 81 of file report.cpp.

Referenced by NLMISC::CHeapAllocator::debugReportMemoryLeak(), and NLMISC::CMsgBoxDisplayer::doDisplay().

00082 {
00083 }

template<class T>
void rotateCCW const T *  src,
T *  dst,
uint  srcWidth,
uint  srcHeight
 

Definition at line 2283 of file bitmap.cpp.

References src, uint, x, and y.

Referenced by NLMISC::CBitmap::rotateCCW().

02284 {
02285         for (uint y=0; y<srcHeight; y++)
02286         for (uint x=0; x<srcWidth; x++)
02287         {
02288                 uint dstX=y;
02289                 uint dstY=srcWidth-x-1;
02290                 dst[dstX+dstY*srcHeight]=src[x+y*srcWidth];
02291         }
02292 }

template<class T, class U>
T safe_cast o  )  [inline]
 

safe_cast<>: this is a function which nlassert() a dynamic_cast in Debug, and just do a static_cast in release. So slow check is made in debug, but only fast cast is made in release.

Definition at line 506 of file debug.h.

00510               : this is a function which nlassert() a dynamic_cast in Debug, and just do a static_cast in release.
00511  * So slow check is made in debug, but only fast cast is made in release.
00512  * Differs from safe_cast by allowinf NULL objets.
00513  */

void ScanEdge CPolygon2D::TRasterVect outputVect,
sint  topY,
const CVector2f &  v1,
const CVector2f &  v2,
bool  rightEdge = true
[static]
 

***************************************************************************************

Definition at line 1003 of file polygon.cpp.

References height, sint, NLMISC::CPolygon2D::TRasterVect, uint, NLMISC::CVector2f::x, and NLMISC::CVector2f::y.

Referenced by NLMISC::CPolygon2D::computeBorders().

01004 {
01005          const uint rol16 = 65536;
01006          sint ceilY1 = (sint) ceilf(v1.y);
01007          sint height;
01008          float deltaX, deltaY;
01009          float fInverseSlope;
01010          sint  iInverseSlope, iPosX;
01011 
01012          // check wether this segment gives a contribution to the final poly
01013          height = (sint) (ceilf(v2.y) - ceilY1);
01014          if (height <= 0) return;
01015 
01016          // compute slope
01017          deltaY = v2.y - v1.y;
01018          deltaX = v2.x - v1.x;
01019          fInverseSlope = deltaX / deltaY;
01020 
01021          
01022          CPolygon2D::TRasterVect::iterator  outputIt = outputVect.begin() + (ceilY1 - topY);
01023 
01024          // slope with ints
01025          iInverseSlope = (sint) (rol16 * fInverseSlope);         
01026 
01027          // sub-pixel accuracy
01028          iPosX = (int) (rol16 * (v1.x + fInverseSlope * (ceilY1 - v1.y))); 
01029 
01030          const CPolygon2D::TRasterVect::iterator endIt = outputIt + height;
01031          if (rightEdge)
01032          {              
01033                  do
01034                  {
01035                    outputIt->second =  iPosX >> 16;     
01036                    iPosX += iInverseSlope;
01037                    ++outputIt;
01038                  }
01039                  while (outputIt != endIt);
01040          }
01041          else
01042          {      
01043                  iPosX += (rol16 - 1);
01044                  do
01045                  {
01046                    outputIt->first =  iPosX >> 16;      
01047                    iPosX += iInverseSlope;
01048                    ++outputIt;
01049                  }
01050                  while (outputIt != endIt);
01051          }
01052 }

void ScanInnerEdge CPolygon2D::TRaster r,
float  x1,
float  y1,
float  x2,
float  y2,
sint  minY,
bool  rightEdge
[static]
 

Definition at line 1517 of file polygon.cpp.

References height, min, r, sint, sint32, NLMISC::CPolygon2D::TRaster, and uint.

Referenced by NLMISC::CPolygon2D::computeInnerBorders().

01518 {               
01519         const uint rol16 = 65536;
01520         CPolygon2D::TRaster *currRaster;
01521         float deltaX, deltaY;
01522         float inverseSlope;
01523         sint32  iInverseSlope, iposx;
01524         sint  height;
01525         deltaX = x2 - x1;
01526         height = (sint) (ceilf(y2) - floorf(y1));
01527         if (height <= 0) return;
01528         deltaY = y2 - y1;               
01529         inverseSlope = deltaX / deltaY;
01530         iInverseSlope = (sint32) (rol16 * inverseSlope);
01531         currRaster = r + ((sint) floorf(y1) - minY);
01532         iposx = (sint32) (rol16 * (x1 + inverseSlope * (ceilf(y1) - y1))); // sub-pixel accuracy        
01533         if (rightEdge)
01534         {       
01535                 iposx -= rol16 - 1;                                     
01536                 if (deltaX >= 0.f)
01537                 {       
01538                         // start of segment             
01539                         if (floorf(y1) != y1)
01540                         {                       
01541                                 currRaster->second = std::min((sint) floorf(x1) - 1, currRaster->second);
01542                                 ++ currRaster;
01543                                 -- height;
01544                                 if (height == 0) return;
01545                         }
01546                         do
01547                         {
01548                                 currRaster->second = std::min((sint) (iposx >> 16), currRaster->second);
01549                                 iposx += iInverseSlope;
01550                                 ++ currRaster;                  
01551                         }
01552                         while (--height);                       
01553                 }
01554                 else
01555                 {
01556                         // start of segment             
01557                         if (floorf(y1) != y1)
01558                         {       
01559                                 currRaster->second = std::min((sint) (iposx >> 16), currRaster->second);
01560                                 ++ currRaster;
01561                                 -- height;
01562                                 if (height == 0) return;
01563                         }
01564                         while (--height)
01565                         {
01566                                 iposx += iInverseSlope;
01567                                 currRaster->second = std::min((sint) (iposx >> 16), currRaster->second);
01568                                 ++ currRaster;                  
01569                         }                       
01570                         // fill bottom of segment                       
01571                         currRaster->second = std::min((sint) floorf(x2) - 1, currRaster->second);                       
01572                 }                                                               
01573         }
01574         else
01575         {       
01576                 iposx += rol16 - 1;                                     
01577                 if (deltaX < 0.f)
01578                 {                               
01579                         // start of segment             
01580                         if (floorf(y1) != y1)
01581                         {                       
01582                                 currRaster->first = std::max((sint) ceilf(x1), currRaster->first);
01583                                 ++ currRaster;
01584                                 -- height;
01585                                 if (height == 0) return;
01586                         }
01587                         do
01588                         {
01589                                 currRaster->first = std::max((sint) (iposx >> 16), currRaster->first);
01590                                 iposx += iInverseSlope;
01591                                 ++ currRaster;                  
01592                         }
01593                         while (--height);                       
01594                 }
01595                 else
01596                 {
01597                         // start of segment             
01598                         if (floorf(y1) != y1)
01599                         {               
01600                                 currRaster->first = std::max((sint) (iposx >> 16), currRaster->first);
01601                                 ++ currRaster;
01602                                 -- height;
01603                                 if (height == 0) return;
01604                         }
01605                         while (--height)
01606                         {
01607                                 iposx += iInverseSlope;
01608                                 currRaster->first = std::max((sint) (iposx >> 16), currRaster->first);
01609                                 ++ currRaster;                  
01610                         }                       
01611                         // fill bottom of segment                       
01612                         currRaster->first = std::max((sint) ceilf(x1), currRaster->first);                      
01613                 }                                                                               
01614         }
01615 }

void ScanOuterEdgeLeft CPolygon2D::TRaster r,
float  x1,
float  y1,
float  x2,
float  y2,
sint  minY
[static]
 

Definition at line 1288 of file polygon.cpp.

References height, min, r, sint, sint32, and NLMISC::CPolygon2D::TRaster.

Referenced by NLMISC::CPolygon2D::computeOuterBorders().

01289 {       
01290         CPolygon2D::TRaster *currRaster;
01291         float deltaX, deltaY;
01292         float inverseSlope;
01293         sint32   iInverseSlope, iposx;
01294         sint  height;
01295         deltaX = x2 - x1;
01296         height = (sint) (ceilf(y2) - floorf(y1)) ;
01297         if (height <= 0) return;
01298         if (deltaX < 0.f)
01299         {                                                       
01300                 if (height == 1)
01301                 {
01302                         currRaster = r + ((sint) floorf(y1) - minY);
01303                         currRaster->first = std::min((sint) floorf(x2), currRaster->first);
01304                 }
01305                 else
01306                 {               
01307                         deltaY = y2 - y1;               
01308                         inverseSlope = deltaX / deltaY;
01309                         iInverseSlope = (sint32) (65536.0 * inverseSlope);
01310                         currRaster = r + ((sint) floorf(y1) - minY);
01311                         iposx = (sint32) (65536.0 * (x1 + inverseSlope * (ceilf(y1) - y1))); // sub-pixel accuracy
01312                         do
01313                         {
01314                                 currRaster->first = std::min((sint) (iposx >> 16), currRaster->first);
01315                                 iposx += iInverseSlope;
01316                                 ++ currRaster;
01317                                 -- height;
01318                         }
01319                         while (height != 1);    
01320                         // correction for last line
01321                         currRaster->first = std::min((sint) floorf(x2), currRaster->first);
01322                 }
01323         }
01324         else
01325         {
01326                 deltaY = y2 - y1;               
01327                 inverseSlope = deltaX / deltaY;
01328                 iInverseSlope = (sint32) (65536.0 * inverseSlope);
01329                 currRaster = r + ((sint) floorf(y1) - minY);
01330                 currRaster->first = std::min((sint) floorf(x1), currRaster->first);
01331                 ++ currRaster;
01332                 iposx = (sint32) (65536.0 * (x1 + inverseSlope * (ceilf(y1) - y1))); // sub-pixel accuracy
01333                 while (--height)
01334                 {                       
01335                         currRaster->first = std::min((sint) (iposx >> 16), currRaster->first);
01336                         iposx += iInverseSlope;
01337                         ++ currRaster;                  
01338                 }               
01339         }       
01340 }

void ScanOuterEdgeRight CPolygon2D::TRaster r,
float  x1,
float  y1,
float  x2,
float  y2,
sint  minY
[static]
 

Definition at line 1232 of file polygon.cpp.

References height, r, sint, sint32, and NLMISC::CPolygon2D::TRaster.

Referenced by NLMISC::CPolygon2D::computeOuterBorders().

01233 {               
01234         CPolygon2D::TRaster *currRaster;
01235         float deltaX, deltaY;
01236         float inverseSlope;
01237         sint32  iInverseSlope, iposx;
01238         sint  height;
01239         deltaX = x2 - x1;
01240         height = (sint) (ceilf(y2) - floorf(y1)) ;
01241         if (height <= 0) return;
01242         if (deltaX >= 0.f)
01243         {                                                       
01244                 if (height == 1)
01245                 {
01246                         currRaster = r + ((sint) floorf(y1) - minY);
01247                         currRaster->second = std::max((sint) floorf(x2), currRaster->second);
01248                 }
01249                 else
01250                 {               
01251                         deltaY = y2 - y1;               
01252                         inverseSlope = deltaX / deltaY;
01253                         iInverseSlope = (sint32) (65536.0 * inverseSlope);
01254                         currRaster = r + ((sint) floorf(y1) - minY);
01255                         iposx = (sint32) (65536.0 * (x1 + inverseSlope * (ceilf(y1) - y1))); // sub-pixel accuracy
01256                         do
01257                         {
01258                                 currRaster->second = std::max((sint) (iposx >> 16), currRaster->second);
01259                                 iposx += iInverseSlope;
01260                                 ++ currRaster;
01261                                 -- height;
01262                         }
01263                         while (height != 1);    
01264                         // correction for last line
01265                         currRaster->second = std::max((sint) floorf(x2), currRaster->second);
01266                 }
01267         }
01268         else
01269         {
01270                 deltaY = y2 - y1;               
01271                 inverseSlope = deltaX / deltaY;
01272                 iInverseSlope = (sint32) (65536.0 * inverseSlope);
01273                 currRaster = r + ((sint) floorf(y1) - minY);
01274                 currRaster->second = std::max((sint) floorf(x1), currRaster->second);
01275                 ++ currRaster;
01276                 iposx = (sint32) (65536.0 * (x1 + inverseSlope * (ceilf(y1) - y1))); // sub-pixel accuracy
01277                 while (--height)
01278                 {                       
01279                         currRaster->second = std::max((sint) (iposx >> 16), currRaster->second);
01280                         iposx += iInverseSlope;
01281                         ++ currRaster;                  
01282                 }               
01283         }
01284 }

template<class T>
uint searchLowerBound const std::vector< T > &  array,
const T &  key
 

Search the lower_bound in a sorted array of Value, in growing order (0, 1, 2....). operator<= is used to perform the comparison. It return the first element such that array[id]<=key If not possible, 0 is returned NB: but 0 may still be a good value, so you must check wether or not 0 means "Not found", or "Id 0".

Definition at line 109 of file algo.h.

References searchLowerBound(), size, and uint.

00110 {
00111         uint    size= array.size();
00112         if(size==0)
00113                 return 0;
00114         else
00115                 return searchLowerBound(&array[0], size, key);
00116 }

template<class T>
uint searchLowerBound const T *  array,
uint  arraySize,
const T &  key
 

Search the lower_bound in a sorted array of Value, in growing order (0, 1, 2....). operator<= is used to perform the comparison. It return the first element such that array[id]<=key If not possible, 0 is returned NB: but 0 may still be a good value, so you must check wether or not 0 means "Not found", or "Id 0".

Definition at line 82 of file algo.h.

References uint.

Referenced by NL3D::CTrackSampledCommon::evalTime(), NL3D::CHLSTextureManager::findTexture(), and searchLowerBound().

00083 {
00084         uint    start=0;
00085         uint    end= arraySize;
00086         // find lower_bound by dichotomy
00087         while(end-1>start)
00088         {
00089                 uint    pivot= (end+start)/2;
00090                 // return the lower_bound, ie return first start with array[pivot]<=key
00091                 if(array[pivot] <= key)
00092                         start= pivot;
00093                 else
00094                         end= pivot;
00095         }
00096 
00097         return start;
00098 }

std::string NLMISC::secondsToHumanReadable uint32  time  ) 
 

Convert a time into a string that is easily readable by an human, for example 3600 -> "1h".

Definition at line 476 of file common.cpp.

References res, toString(), uint, and uint32.

Referenced by NLMISC_COMMAND(), and NLNET::NLMISC_DYNVARIABLE().

00477 {
00478         static char *divTable[] = { "s", "mn", "h", "d" };
00479         static uint  divCoef[]  = { 60, 60, 24 };
00480         uint div = 0;
00481         uint32 res = time;
00482         uint32 newres = res;
00483         while (true)
00484         {
00485                 if(div > 2)
00486                         break;
00487 
00488                 newres /= divCoef[div];
00489                 
00490                 if(newres < 3)
00491                         break;
00492 
00493                 div++;
00494                 res = newres;
00495         }
00496         return toString ("%u%s", res, divTable[div]);
00497 }

void NLMISC::setAssert bool  assert  ) 
 

Definition at line 110 of file debug.cpp.

References assert, and NoAssert.

Referenced by NLNET::IService::main().

00111 {
00112         NoAssert = !assert;
00113 }

void NLMISC::setCrashCallback TCrashCallback  crashCallback  ) 
 

Definition at line 104 of file debug.cpp.

References CrashCallback, and TCrashCallback.

00105 {
00106         CrashCallback = crashCallback;
00107 }

void NLMISC::setReportEmailFunction void *  emailFunction  ) 
 

call this in the main of your appli to enable email: setReportEmailFunction (sendEmail);

Definition at line 67 of file report.cpp.

References EmailFunction, and TEmailFunction.

Referenced by NLNET::IService::main().

00068 {
00069         EmailFunction = (TEmailFunction)emailFunction;
00070 
00071 #ifdef NL_OS_WINDOWS
00072         if (sendReport)
00073                 EnableWindow(sendReport, FALSE);
00074 #endif
00075 }

char* skipToken const char *  p  )  [inline, static]
 

Definition at line 2259 of file misc/heap_allocator.cpp.

Referenced by NLMISC::CHeapAllocator::getAllocatedSystemMemory().

02260 {
02261     while (isspace(*p)) p++;
02262     while (*p && !isspace(*p)) p++;
02263     return (char *)p;
02264 }

char* skipWS const char *  p  )  [inline, static]
 

Definition at line 2253 of file misc/heap_allocator.cpp.

Referenced by NLMISC::CHeapAllocator::getAllocatedSystemMemory().

02254 {
02255     while (isspace(*p)) p++;
02256     return (char *)p;
02257 }

sint NLMISC::smprintf char *  buffer,
size_t  count,
const char *  format,
... 
 

sMart sprintf function. This function do a sprintf and add a zero at the end of the buffer if there no enough room in the buffer.

Parameters:
buffer a C string
count Size of the buffer
format of the string, it must be the last argument before the '...'

Definition at line 161 of file common.cpp.

References buffer, count, format, and sint.

Referenced by NLMISC::IDisplayer::dateToComputerString(), NLMISC::CHeapAllocator::debugReportMemoryLeak(), NLMISC::CHTimer::display(), NLMISC::CBufFIFO::display(), NLMISC::CHTimer::displayByExecutionPath(), NLMISC::EBadSize::EBadSize(), NLMISC::EBadType::EBadType(), NLMISC::EFileNotFound::EFileNotFound(), NL3D::CDriverGL::endProfileVBHardLock(), NLMISC::EParseError::EParseError(), NLMISC::EUnknownVar::EUnknownVar(), NLGEORGES::CFormElmArray::getFormName(), NL3D::CFontGenerator::getFT2Error(), NLGEORGES::CFormElm::getIternalNodeByName(), NL3D::CTextureBlend::getShareName(), NL3D::CDriverGL::getSpecularCubeMap(), NLMISC::CHTimer::CStats::getStats(), NLNET::_CUniTime::getStringUniTime(), NL3D::IDriver::getTextureShareName(), NL3D::CDriverGL::getVideocardInformation(), NLLOGIC::getXMLProp(), NLMISC::IDisplayer::HeaderString(), NLMISC::CFile::isDirectory(), NLSOUND::CSoundAnimation::save(), NLNET::CLoginCookie::setToString(), NLGEORGES::CFormElm::setValueByName(), NLGEORGES::warning(), NLGEORGES::CFileHeader::write(), and NLLOGIC::xmlCheckNodeName().

00162 {
00163         sint ret;
00164 
00165         va_list args;
00166         va_start( args, format );
00167         ret = vsnprintf( buffer, count, format, args );
00168         if ( ret == -1 )
00169         {
00170                 buffer[count-1] = '\0';
00171         }
00172         va_end( args );
00173 
00174         return( ret );
00175 }

void NLMISC::splitString const std::string &  str,
const std::string &  separator,
std::vector< std::string > &  retList
 

From a string with some separator, build a vector of string. eg: splitString("hello|bye|||bee", "|", list) return 3 string into list: "hello", "bye" and "bee".

Definition at line 122 of file algo.cpp.

References uint.

00123 {
00124         uint    pos=0;
00125         uint    newPos=0;
00126         retList.clear();
00127         while( (newPos= str.find(separator,pos)) != string::npos)
00128         {
00129                 // if not empty sub str. (skip repetition of separator )
00130                 if(newPos-pos>0)
00131                         retList.push_back(str.substr(pos, newPos-pos));
00132                 // skip token
00133                 pos= newPos+separator.size();
00134         }
00135         // copy the last substr
00136         if( pos<(uint)str.size() )
00137                 retList.push_back(str.substr(pos, str.size()-pos));
00138 }

template<class T>
T sqr const T &  v  )  [inline]
 

Return the square of a number

Definition at line 107 of file common.h.

References v.

Referenced by NLMISC::CHTimer::CStats::buildFromNodes(), NL3D::CLVBSqrDistLUT::CLVBSqrDistLUT(), NL3D::CPatchDLMPointLight::compile(), NL3D::CLodCharacterShapeBuild::compile(), NL3D::CHLSColorTexture::compressBlockRGB(), NL3D::CTessVertex::computeGeomPos(), NL3D::CPointLight::computeLinearAttenuation(), NL3D::CPatch::computeNewFar(), NL3D::CTessFace::computeTileEMForUpdateRefine(), NL3D::CTessFace::computeTileErrorMetric(), NL3D::CVegetable::generateGroupEx(), NLPACS::CSurfaceQuadTree::getInterpZ(), NL3D::CVisualCollisionEntity::getPatchTriangleUnderUs(), NL3D::CLandscape::getTesselatedPos(), NL3D::CPSFloatCurveFunctor::getValue(), NLMISC::CBSphere::include(), NLMISC::CBSphere::intersect(), NL3D::CCameraCol::minimizeDistanceAgainstTri(), NL3D::CTessFace::updateErrorMetric(), and NL3D::CLandscape::updateGlobalsAndLockBuffers().

00108 {
00109         return v * v;
00110 }

template<class T, class U>
bool strFindReplace T &  str,
const char *  strFind,
const U &  strReplace
 

Definition at line 188 of file algo.h.

References strFindReplace().

00189 {
00190         T       tempStr= strFind;
00191         return strFindReplace(str, tempStr, strReplace);
00192 }

template<class T, class U>
bool strFindReplace T &  str,
const T &  strFind,
const U &  strReplace
 

In a string or ucstring, find a substr and replace it with an other. return true if replaced.

Definition at line 176 of file algo.h.

References uint.

Referenced by strFindReplace().

00177 {
00178         uint    pos= str.find(strFind);
00179         if(pos != T::npos)
00180         {
00181                 str.replace(pos, strFind.size(), T(strReplace) );
00182                 return true;
00183         }
00184         else return false;
00185 }

int stricmp const char *  lhs,
const char *  rhs
[inline]
 

Compare 2 C-Style strings without regard to case

Returns:
0 if strings are equal, < 0 if lhs < rhs, > 0 if lhs > rhs
On Windows, use stricmp On GNU/Linux, create stricmp using strcasecmp and use stricmp

Definition at line 225 of file common.h.

Referenced by NLMISC::CSString::icompare(), nlstricmp(), NLMISC::CSString::operator!=(), NLMISC::CSString::operator<(), NLMISC::CSString::operator<=(), NLMISC::CSString::operator==(), NLMISC::CSString::operator>(), and NLMISC::CSString::operator>=().

00225 { return strcasecmp(lhs, rhs); }

std::string stringFromVector const std::vector< uint8 > &  v,
bool  limited = true
 

Returns a readable string from a vector of bytes. unprintable char are replaced by '?'.

string stringFromVector const vector< uint8 > &  v,
bool  limited
 

Definition at line 107 of file common.cpp.

References s, size, uint8, and v.

Referenced by NLNET::CBufServer::dataAvailable(), NLNET::CBufClient::dataAvailable(), and NLNET::CNonBlockingBufSock::receivePart().

00108 {
00109         string s;
00110 
00111         if (!v.empty())
00112         {
00113                 int size = v.size ();
00114                 if (limited && size > 1000)
00115                 {
00116                         string middle = "...<buf too big,skip middle part>...";
00117                         s.resize (1000 + middle.size());
00118                         memcpy (&*s.begin(), &*v.begin(), 500);
00119                         memcpy (&*s.begin()+500, &*middle.begin(), middle.size());
00120                         memcpy (&*s.begin()+500+middle.size(), &*v.begin()+size-500, 500);
00121                 }
00122                 else
00123                 {
00124                         s.resize (size);
00125                         memcpy( &*s.begin(), &*v.begin(), v.size() );
00126                 }
00127 
00128                 // Replace '\0' characters
00129                 string::iterator is;
00130                 for ( is=s.begin(); is!=s.end(); ++is )
00131                 {
00132                         // remplace non printable char and % with '?' chat
00133                         if ( ! isprint((uint8)(*is)) || (*is) == '%')
00134                         {
00135                                 (*is) = '?';
00136                         }
00137                 }
00138         }
00139 /*
00140         if ( ! v.empty() )
00141         {
00142                 // Copy contents
00143                 s.resize( v.size() );
00144                 memcpy( &*s.begin(), &*v.begin(), v.size() );
00145 
00146                 // Replace '\0' characters
00147                 string::iterator is;
00148                 for ( is=s.begin(); is!=s.end(); ++is )
00149                 {
00150                         // remplace non printable char and % with '?' chat
00151                         if ( ! isprint((*is)) || (*is) == '%')
00152                         {
00153                                 (*is) = '?';
00154                         }
00155                 }
00156         }
00157 */      return s;
00158 }

char * NLMISC::strlwr char *  str  ) 
 

Convert a string in lower case.

Parameters:
a pointer to char to transform to lower case

Definition at line 564 of file common.cpp.

00565 {
00566         if (str == NULL)
00567                 return NULL;
00568 
00569         while (*str != '\0')
00570         {
00571                 if ( (*str >= 'A') && (*str <= 'Z') )
00572                 {
00573                         *str = *str - 'A' + 'a';
00574                 }
00575                 str++;
00576         }
00577 
00578         return str;
00579 }

std::string & NLMISC::strlwr std::string &  str  ) 
 

Convert a string in lower case.

Parameters:
a string to transform to lower case

Definition at line 551 of file common.cpp.

References uint.

00552 {
00553         for (uint i = 0; i < str.size(); i++)
00554         {
00555                 if ( (str[i] >= 'A') && (str[i] <= 'Z') )
00556                 {
00557                         str[i] = str[i] - 'A' + 'a';
00558                 }
00559         }
00560 
00561         return str;
00562 }

std::string NLMISC::strlwr const std::string &  str  ) 
 

Definition at line 536 of file common.cpp.

References res, and uint.

Referenced by NL3D::CShapeBank::add(), NLMISC::CBigFile::add(), NL3D::CShapeBank::addRef(), NL3D::CHLSTextureBank::addTextureInstance(), NL3D::CAsyncTextureManager::addTextureRef(), NL3D::CInstanceGroup::addToSceneAsync(), NLLIGO::CPrimitiveConfigurations::belong(), NLMISC::CSheetId::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CShapeBank::cancelLoadAsync(), NLGEORGES::CFormElm::convertValue(), NL3D::CScene::createInstance(), NL3D::CScene::createInstanceAsync(), NLMISC::ICommand::expand(), NL3D::CHLSTextureManager::findTexture(), NLMISC::CEntityIdTranslator::getByEntity(), NLMISC::CEntityIdTranslator::getByUser(), NLGEORGES::CFormDfn::getDependencies(), NLGEORGES::CForm::getDependencies(), NL3D::CTileBank::getDisplacementMap(), NLMISC::CBigFile::getFile(), NLMISC::CBigFile::getFileNamePtr(), NL3D::CTileBank::getNumBitmap(), NLMISC::CEntityIdTranslator::getRegisterableString(), NL3D::CShapeBank::getShape(), NL3D::CInstanceGroup::getShapeName(), NL3D::CTextureFile::getShareName(), NL3D::IDriver::getTextureShareName(), H_AUTO_DECL(), NL3D::CShapeBank::isPresent(), NL3D::CShapeBank::linkShapeToShapeCache(), NLMISC::CBigFile::list(), NL3D::CShapeBank::load(), NL3D::CShapeBank::loadAsync(), NLGEORGES::CFormLoader::loadForm(), NLGEORGES::CFormLoader::loadFormDfn(), NLMISC::CSheetId::loadSheetAlias(), NLMISC::CSheetId::loadSheetId(), NLGEORGES::CFormLoader::loadType(), NLMISC::CSheetId::operator=(), NL3D::CShapeBank::preLoadShapes(), NLLIGO::CPrimitiveClass::read(), NL3D::CCoarseMeshBuild::remapCoordinates(), NLMISC::CPath::remapExtension(), NLMISC::CPath::remapFile(), NL3D::CDriverGL::retrieveATIDriverVersion(), NLNET::sendEmail(), NL3D::CInstanceGroup::stopAddToSceneAsync(), and NLMISC::CSheetId::typeFromFileExtension().

00537 {
00538         string res;
00539         res.reserve (str.size());
00540         for (uint i = 0; i < str.size(); i++)
00541         {
00542                 if ( (str[i] >= 'A') && (str[i] <= 'Z') )
00543                         res += str[i] - 'A' + 'a';
00544                 else
00545                         res += str[i];
00546         }
00547 
00548         return res;
00549 }

char * NLMISC::strupr char *  str  ) 
 

Convert a string in upper case.

Parameters:
a pointer to char to transform to upper case

Definition at line 610 of file common.cpp.

00611 {
00612         if (str == NULL)
00613                 return NULL;
00614 
00615         while (*str != '\0')
00616         {
00617                 if ( (*str >= 'a') && (*str <= 'z') )
00618                 {
00619                         *str = *str - 'a' + 'A';
00620                 }
00621                 str++;
00622         }
00623 
00624         return str;
00625 }

std::string NLMISC::strupr const std::string &  str  ) 
 

Definition at line 594 of file common.cpp.

References res, and uint.

00595 {
00596         string res;
00597         res.reserve (str.size());
00598         for (uint i = 0; i < str.size(); i++)
00599         {
00600                 if ( (str[i] >= 'a') && (str[i] <= 'z') )
00601                         res += str[i] - 'a' + 'A';
00602                 else
00603                         res += str[i];
00604         }
00605         
00606         return res;
00607 }

std::string & NLMISC::strupr std::string &  str  ) 
 

Convert a string in upper case.

Parameters:
a string to transform to upper case

Definition at line 581 of file common.cpp.

References uint.

Referenced by H_AUTO_DECL(), and NLNET::IService::main().

00582 {
00583         for (uint i = 0; i < str.size(); i++)
00584         {
00585                 if ( (str[i] >= 'a') && (str[i] <= 'z') )
00586                 {
00587                         str[i] = str[i] - 'a' + 'A';
00588                 }
00589         }
00590 
00591         return str;
00592 }

bool NLMISC::testWildCard const char *  strIn,
const char *  wildCard
 

return true if the string strIn verify the wildcard string wildCard. eg: testWildCard("azert", "*")== true testWildCard("azert", "??er*")== true testWildCard("azert", "*er*")== true testWildCard("azert", "azert*")== true Undefined result if s has some '*', return false if wildcard has some "**" or "*?" NB: case-sensitive

Definition at line 45 of file algo.cpp.

References testWildCard(), and uint.

00046 {
00047         // run the 2 string in //el
00048         while(*wildCard!=0 && *strIn!=0)
00049         {
00050                 // if same char, continue.
00051                 if(*wildCard==*strIn)
00052                 {
00053                         wildCard++;
00054                         strIn++;
00055                 }
00056                 // if wildCard is ?, continue
00057                 else if(*wildCard=='?')
00058                 {
00059                         wildCard++;
00060                         strIn++;
00061                 }
00062                 // if wildcard is *, recurs check.
00063                 else if(*wildCard=='*')
00064                 {
00065                         wildCard++;
00066                         // if last *, its OK.
00067                         if(*wildCard==0)
00068                                 return true;
00069                         // else must check next strings.
00070                         else
00071                         {
00072                                 // build the wilcard token. eg from "*pipo?", take "pipo"
00073                                 string  token;
00074                                 while(*wildCard!='*' && *wildCard!='?' && *wildCard!=0)
00075                                 {
00076                                         token+= *wildCard;
00077                                         wildCard++;
00078                                 }
00079                                 // if token size is empty, error
00080                                 if(token.empty())
00081                                         return false;
00082 
00083                                 // in strIn, search all the occurence of token. For each solution, recurs test.
00084                                 string  sCopy= strIn;
00085                                 uint    pos= sCopy.find(token, 0);
00086                                 while(pos!=string::npos)
00087                                 {
00088                                         // do a testWildCard test on the remaining string/wildCard
00089                                         if( testWildCard(strIn+pos+token.size(), wildCard) )
00090                                                 // if succeed, end
00091                                                 return true;
00092                                         // fails=> test with an other occurence of token in the string.
00093                                         pos= sCopy.find(token, pos+1);
00094                                 }
00095                                 
00096                                 // if all failed, fail
00097                                 return false;
00098                         }
00099                 }
00100                 // else fail
00101                 else
00102                         return false;
00103         }
00104 
00105         // If quit here because end Of 2 strs, OK.
00106         if(*wildCard==0 && *strIn==0)
00107                 return true;
00108         // if quit here because wildCard=="*" and s="", OK too.
00109         if(*strIn==0 && wildCard[0]=='*' && wildCard[1]==0)
00110                 return true;
00111 
00112         /*
00113                 Else false:
00114                         It may be wildCard="?aez" and s="" => error
00115                         It may be wildCard="" and s="aer" => error
00116         */
00117         return false;
00118 }

bool NLMISC::testWildCard const std::string &  strIn,
const std::string &  wildCard
 

Definition at line 38 of file algo.cpp.

Referenced by NLMISC::CEntityIdTranslator::isValidEntityName(), NL3D::CShapeBank::preLoadShapes(), and testWildCard().

00039 {
00040         return testWildCard(strIn.c_str(), wildCard.c_str());
00041 }

std::string toString const std::string &  val  )  [inline]
 

Definition at line 197 of file string_common.h.

00197 { return val; }

std::string toString const bool &  val  )  [inline]
 

Definition at line 196 of file string_common.h.

References toString().

00196 { return toString("%u", val?1:0); }

std::string toString const double &  val  )  [inline]
 

Definition at line 195 of file string_common.h.

References toString().

00195 { return toString("%lf", val); }

std::string toString const float &  val  )  [inline]
 

Definition at line 194 of file string_common.h.

References toString().

00194 { return toString("%f", val); }

std::string toString const sint64 val  )  [inline]
 

Definition at line 193 of file string_common.h.

References NL_I64, sint64, and toString().

00193 { return toString("%"NL_I64"d", val); }

std::string toString const uint64 val  )  [inline]
 

Definition at line 192 of file string_common.h.

References NL_I64, toString(), and uint64.

00192 { return toString("%"NL_I64"u", val); }

std::string toString const sint32 val  )  [inline]
 

Definition at line 191 of file string_common.h.

References sint32, and toString().

00191 { return toString("%d", val); }

std::string toString const uint32 val  )  [inline]
 

Definition at line 190 of file string_common.h.

References toString(), and uint32.

00190 { return toString("%u", val); }

std::string toString const sint16 val  )  [inline]
 

Definition at line 189 of file string_common.h.

References sint16, and toString().

00189 { return toString("%hd", val); }

std::string toString const uint16 val  )  [inline]
 

Definition at line 188 of file string_common.h.

References toString(), and uint16.

00188 { return toString("%hu", val); }

std::string toString const sint8 val  )  [inline]
 

Definition at line 187 of file string_common.h.

References sint16, sint8, and toString().

00187 { return toString("%hd", (sint16)val); }

std::string toString const uint8 val  )  [inline]
 

Definition at line 186 of file string_common.h.

References toString(), uint16, and uint8.

00186 { return toString("%hu", (uint16)val); }

template<class T>
std::string toString const T &  obj  ) 
 

Template Object toString.

Parameters:
obj any object providing a "std::string toString()" method. The object doesn't have to derive from anything.
the VC++ error "error C2228: left of '.toString' must have class/struct/union type" means you don't provide a toString() method to your object.

Definition at line 180 of file string_common.h.

00181 {
00182         return obj.toString();
00183 }

std::string toString const char *  format,
... 
[inline]
 

Definition at line 157 of file string_common.h.

References format, and NLMISC_CONVERT_VARGS.

00159 {
00160         std::string Result;
00161         NLMISC_CONVERT_VARGS(Result, format, NLMISC::MaxCStringSize);
00162         return Result;
00163 }

std::string NLMISC::toString NL3D::CPSEmitter::TEmissionType  type  ) 
 

Definition at line 2652 of file ps_emitter.cpp.

References nlassert, nlctassert, and type.

Referenced by NLNET::CUnifiedNetwork::addNamedCnx(), NLNET::CUnifiedNetwork::addService(), NLNET::CInetAddress::asIPString(), NLNET::CInetAddress::asString(), NLMISC::CConfigFile::CVar::asString(), NLNET::CBufSock::asString(), NL3D::CZoneSymmetrisation::build(), NL3D::CCoarseMeshBuild::buildBitmap(), bytesToHumanReadable(), NLMISC::CEntityIdTranslator::checkEntity(), NLMISC::CLog::CLog(), NLAINIMAT::CMHiCSbase::dbgPrintClassifierPriorityInFile(), NLNET::CUnifiedNetwork::CUnifiedConnection::display(), NLMISC::CHTimer::display(), NLMISC::CHTimer::displayByExecutionPath(), NLMISC::CBitMemStream::displayStream(), NLMISC::CWindowDisplayer::doDisplay(), NLMISC::CMemDisplayer::doDisplay(), NLMISC::CMsgBoxDisplayer::doDisplay(), NLMISC::CFileDisplayer::doDisplay(), NLMISC::CStdDisplayer::doDisplay(), NLMISC::CTaskManager::dump(), dumpOperand(), NL3D::CDriverGL::endProfileVBHardLock(), NLMISC::CVariable< std::string >::execute(), NLGEORGES::CFormElmArray::getArrayNodeName(), NL3D::CFontManager::getCacheInformation(), NLAINIMAT::CMHiCSagent::getDebugString(), NLAINIMAT::CMotivationEnergy::getDebugString(), NLAINIMAT::CClassifierSystem::getDebugString(), NLMISC::CBMSDbgInfo::getEventIdAtBitPos(), NLMISC::CBMSDbgInfo::getEventLegendAtBitPos(), NLMISC::CSystemInfo::getOS(), NLMISC::CBitMemStream::getSerialItem(), NLNET::CUnifiedNetwork::getServiceUnifiedName(), NLNET::IService::getServiceUnifiedName(), NLMISC::CVariable< std::string >::getStat(), NLMISC::CHTimer::CStats::getStats(), NLMISC::CWordsDictionary::init(), NLNET::CUnifiedNetwork::init(), NLNET::internalIPAddressToString(), NL3D::CZoneLighter::light(), NLNET::IService::main(), NLMISC_COMMAND(), NLNET::NLMISC_DYNVARIABLE(), CVPParser::parse(), STRING_MANAGER::prepareStringFile(), NL3D::CDriverGL::profileVBHardAllocation(), NLNET::CNonBlockingBufSock::receivePart(), NLPACS::CGlobalRetriever::refreshLrAround(), NLPACS::CGlobalRetriever::refreshLrAroundNow(), NL3D::CCoarseMeshBuild::remapCoordinates(), NLNET::CUnifiedNetwork::removeNamedCnx(), NLMISC::CTaskManager::run(), secondsToHumanReadable(), NL3D::CPSEmitter::setEmissionType(), NL3D::CDriverGL::setupEXTVertexShader(), NLGEORGES::CFormElm::setValueByName(), NLAINIMAT::CMHiCSagent::targetId2String(), NLMISC::CVector::toString(), NLMISC::CVariable< std::string >::toString(), NLMISC::CVariablePtr< T >::toString(), toString(), NLMISC::CSheetId::toString(), CHashKey::toString(), NLNET::CMessage::toString(), NLNET::CLoginCookie::toString(), toStringEnum(), toStringPtr(), NLNET::uncbDisconnection(), NLNET::uncbServiceIdentification(), NLNET::uNetRegistrationBroadcast(), NLNET::uNetUnregistrationBroadcast(), NLLIGO::CPrimitives::write(), NLLIGO::IPrimitive::write(), NLLIGO::WriteFloat(), and NLLIGO::WriteVector().

02653 {
02654         nlctassert(NL3D::CPSEmitter::numEmissionType == 5); // If this ct assertion is raised, the content of TEmissionType has changed, so should change this function !
02655         switch (type)
02656         {
02657                 case NL3D::CPSEmitter::regular: return "regular";
02658                 case NL3D::CPSEmitter::onDeath: return "onDeath";
02659                 case NL3D::CPSEmitter::once: return "once";
02660                 case NL3D::CPSEmitter::onBounce: return "onBounce";
02661                 case NL3D::CPSEmitter::externEmit: return "externEmit";
02662                 default:
02663                         nlassert(0);
02664                         return "";
02665                 break;
02666         }
02667 }

template<class T>
std::string toStringEnum const T &  val  ) 
 

Definition at line 171 of file string_common.h.

References toString(), and uint32.

00171 { return toString("%u", (uint32)val); }

template<class T>
std::string toStringPtr const T *  val  ) 
 

Definition at line 169 of file string_common.h.

References toString().

Referenced by NLNET::CBufSock::asString().

00169 { return toString("%p", val); }

template<class T, class U>
T type_cast o  )  [inline]
 

type_cast<>: this is a function which nlassert() a dynamic_cast in Debug, and just do a static_cast in release. So slow check is made in debug, but only fast cast is made in release. Differs from safe_cast by allowinf NULL objets.

Definition at line 520 of file debug.h.

00523         {
00524                 return static_cast<T >(o);
00525         }
00526         else
00527         {
00528                 return  (o==NULL)?NULL:static_cast<T >(o);
00529         }
00530 
00531 }
00532 
00535 #define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0]);
00536 
00537 

void xmlGenericErrorFuncRead void *  ctx,
const char *  msg,
... 
 

Definition at line 129 of file i_xml.cpp.

References NLMISC_CONVERT_VARGS, and xmlGenericErrorFuncRead().

Referenced by xmlGenericErrorFuncRead().

00130 {
00131         // Get the error string
00132         string str;
00133         NLMISC_CONVERT_VARGS (str, msg, NLMISC::MaxCStringSize);
00134         ((CIXml*)ctx)->_ErrorString += str;
00135 }

void xmlGenericErrorFuncWrite void *  ctx,
const char *  msg,
... 
 

Definition at line 101 of file o_xml.cpp.

References NLMISC_CONVERT_VARGS.

Referenced by NLMISC::COXml::init().

00102 {
00103         // Get the error string
00104         string str;
00105         NLMISC_CONVERT_VARGS (str, msg, NLMISC::MaxCStringSize);
00106         ((COXml*)ctx)->_ErrorString += str;
00107 }

int xmlOutputCloseCallbackForNeL void *  context  ) 
 

Definition at line 662 of file o_xml.cpp.

00663 {
00664         // Get the object
00665         // COXml *object = (COXml*) context;
00666 
00667         // Does nothing
00668         return 1;
00669 }

int xmlOutputWriteCallbackForNeL void *  context,
const char *  buffer,
int  len
 

Definition at line 648 of file o_xml.cpp.

References NLMISC::COXml::_InternalStream, buffer, len, NLMISC::IStream::serialBuffer(), and uint8.

00649 {
00650         // Get the object
00651         COXml *object = (COXml*) context;
00652 
00653         // Serialise the buffer
00654         object->_InternalStream->serialBuffer ((uint8*)buffer, len);
00655 
00656         // Return the value
00657         return len;
00658 }


Variable Documentation

CLog * NLMISC::AssertLog = NULL
 

Definition at line 93 of file debug.cpp.

Referenced by NLNET::cbLogFilter(), createDebug(), initDebug2(), NLNET::IService::main(), and NLMISC_COMMAND().

string NLMISC::BasePathgetPathContent
 

Definition at line 646 of file path.cpp.

const uint32 NLMISC::BF_ALWAYS_OPENED = 0x00000001
 

Big file management

Author:
Matthieu Besson

Nevrax France

Date:
2002

Definition at line 42 of file big_file.h.

Referenced by NLMISC::CBigFile::add().

const uint32 NLMISC::BF_CACHE_FILE_ON_OPEN = 0x00000002
 

Definition at line 43 of file big_file.h.

Referenced by NLMISC::CBigFile::add().

TCrashCallback NLMISC::CrashCallback = NULL [static]
 

Definition at line 102 of file debug.cpp.

Referenced by getCallStackAndLog(), and setCrashCallback().

const uint32 NLMISC::DDS = ((uint32)(uint8)( 'D' ) | ((uint32)(uint8)( 'D' ) << 8) | ((uint32)(uint8)( 'S' ) << 16) | ((uint32)(uint8)( ) << 24 ))
 

Definition at line 59 of file bitmap.h.

Referenced by NLMISC::EDDSBadHeader::EDDSBadHeader(), NLMISC::CBitmap::load(), and NLMISC::CBitmap::loadSize().

CLog * NLMISC::DebugLog = NULL
 

Definition at line 92 of file debug.cpp.

Referenced by NLNET::cbLogFilter(), createDebug(), NLMISC::CBufFIFO::display(), initDebug2(), NLNET::IService::main(), and NLMISC_COMMAND().

bool NLMISC::DebugNeedAssert = false
 

Definition at line 85 of file debug.cpp.

Referenced by NLMISC::CMsgBoxDisplayer::doDisplay().

CMemDisplayer * NLMISC::DefaultMemDisplayer = NULL
 

Definition at line 95 of file debug.cpp.

Referenced by createDebug(), getCallStackAndLog(), initDebug2(), and NLMISC_COMMAND().

CMsgBoxDisplayer * NLMISC::DefaultMsgBoxDisplayer = NULL
 

Definition at line 96 of file debug.cpp.

Referenced by createDebug(), and initDebug2().

const uint32 NLMISC::DXT_ = ((uint32)(uint8)( 'D' ) | ((uint32)(uint8)( 'X' ) << 8) | ((uint32)(uint8)( 'T' ) << 16) | ((uint32)(uint8)( '\0' ) << 24 ))
 

Definition at line 60 of file bitmap.h.

TEmailFunction NLMISC::EmailFunction = NULL [static]
 

Definition at line 65 of file report.cpp.

Referenced by setReportEmailFunction().

CLog * NLMISC::ErrorLog = NULL
 

Definition at line 89 of file debug.cpp.

Referenced by NLNET::cbLogFilter(), createDebug(), initDebug2(), NLNET::IService::main(), and NLMISC_COMMAND().

const CClassId NLMISC::EventActivateId(0x7da66b0a, 0x1ef74519)
 

Referenced by NLMISC::CEventActivate::CEventActivate().

const CClassId NLMISC::EventCharId(0x552255fe, 0x75a2373f)
 

Referenced by NLMISC::CEventChar::CEventChar().

const CClassId NLMISC::EventDestroyWindowId(0x69be73fe, 0x4b07603b)
 

Referenced by NLMISC::CEventDestroyWindow::CEventDestroyWindow().

const CClassId NLMISC::EventGDAxisMovedId(0x073306, 0x41173626)
 

Referenced by NLMISC::CGDAxisMoved::CGDAxisMoved().

const CClassId NLMISC::EventGDButtonDownId(0x57141957, 0x3efb143a)
 

Referenced by NLMISC::CGDButtonDown::CGDButtonDown().

const CClassId NLMISC::EventGDButtonUpId(0x16105e06, 0x302536b2)
 

Referenced by NLMISC::CGDButtonUp::CGDButtonUp().

const CClassId NLMISC::EventGDMouseMove(0x12142bc4, 0x43c73e74)
 

Referenced by NLMISC::CGDMouseMove::CGDMouseMove().

const CClassId NLMISC::EventGDPOVChanged(0x362851b9, 0x395c4d61)
 

Referenced by NLMISC::CGDPOVChanged::CGDPOVChanged().

const CClassId NLMISC::EventGDSliderMovedId(0x68776586, 0x394a6916)
 

Referenced by NLMISC::CGDSliderMoved::CGDSliderMoved().

const CClassId NLMISC::EventKeyDownId(0x3c2643da, 0x43f802a1)
 

Referenced by NLMISC::CEventListenerAsync::addToServer(), NLMISC::CEventKeyDown::CEventKeyDown(), NLMISC::CEventListenerAsync::operator()(), and NLMISC::CEventListenerAsync::removeFromServer().

const CClassId NLMISC::EventKeyUpId(0x1e62e85, 0x68a35d46)
 

Referenced by NLMISC::CEventListenerAsync::addToServer(), NLMISC::CEventKeyUp::CEventKeyUp(), NLMISC::CEventListenerAsync::operator()(), and NLMISC::CEventListenerAsync::removeFromServer().

const CClassId NLMISC::EventMouseDblClkId(0x55a94cb3, 0x3e641517)
 

Referenced by NLMISC::CEventMouseDblClk::CEventMouseDblClk().

const CClassId NLMISC::EventMouseDownId(0x35b7878, 0x5d4a0f86)
 

Referenced by NL3D::CEvent3dMouseListener::addToServer(), NLMISC::CEventMouseDown::CEventMouseDown(), NL3D::CEvent3dMouseListener::operator()(), and NL3D::CEvent3dMouseListener::removeFromServer().

const CClassId NLMISC::EventMouseMoveId(0x3dd12fdb, 0x472f548b)
 

Referenced by NL3D::CEvent3dMouseListener::addToServer(), NLMISC::CEventMouseMove::CEventMouseMove(), NL3D::CEvent3dMouseListener::operator()(), and NL3D::CEvent3dMouseListener::removeFromServer().

const CClassId NLMISC::EventMouseUpId(0xcce1f7e, 0x7ed344d7)
 

Referenced by NL3D::CEvent3dMouseListener::addToServer(), NLMISC::CEventMouseUp::CEventMouseUp(), NL3D::CEvent3dMouseListener::operator()(), and NL3D::CEvent3dMouseListener::removeFromServer().

const CClassId NLMISC::EventMouseWheelId(0x73ac4321, 0x4c273150)
 

Referenced by NL3D::CEvent3dMouseListener::addToServer(), NLMISC::CEventMouseWheel::CEventMouseWheel(), NL3D::CEvent3dMouseListener::operator()(), and NL3D::CEvent3dMouseListener::removeFromServer().

const CClassId NLMISC::EventSetFocusId(0x17650fac, 0x19f85dde)
 

Referenced by NLMISC::CEventListenerAsync::addToServer(), NLMISC::CEventSetFocus::CEventSetFocus(), NLMISC::CEventListenerAsync::operator()(), and NLMISC::CEventListenerAsync::removeFromServer().

CFileDisplayer* NLMISC::fd = NULL [static]
 

Definition at line 99 of file debug.cpp.

Referenced by changeLogDirectory(), createDebug(), and initDebug2().

vector<CFileEntry> NLMISC::FileToCheck [static]
 

Definition at line 1547 of file path.cpp.

Referenced by NLMISC::CFileEntry::CFileEntry(), NLMISC::CFile::getFileCreationDate(), and NLMISC::CFile::removeFileChangeCallback().

bool NLMISC::GlobalAssertCall = false
 

Definition at line 87 of file debug.cpp.

bool NLMISC::HasMMX = DetectMMX()
 

Definition at line 105 of file cpu_info.cpp.

Referenced by NLMISC::CCpuInfo___::hasMMX().

bool NLMISC::HasSSE = DetectSSE()
 

Definition at line 106 of file cpu_info.cpp.

Referenced by NLMISC::CCpuInfo___::hasSSE().

CLog * NLMISC::InfoLog = NULL
 

Definition at line 91 of file debug.cpp.

Referenced by NLNET::cbLogFilter(), NLNET::cleanRequest(), createDebug(), NLMISC::CConfigFile::display(), initDebug2(), NLNET::IService::main(), NLMISC_COMMAND(), and NLMISC::CMemDisplayer::write().

char NLMISC::JPGBuffer[JPGBufferSize]
 

Definition at line 90 of file bitmap.cpp.

const uint32 NLMISC::JPGBufferSize = 1000 [static]
 

Definition at line 89 of file bitmap.cpp.

NLMISC::IStream* NLMISC::JPGStream = NULL
 

Definition at line 88 of file bitmap.cpp.

const char* NLMISC::LogTypeToString[][8] [static]
 

Initial value:

 {
        { "", "ERR", "WRN", "INF", "DBG", "STT", "AST", "UKN" },
        { "", "Error", "Warning", "Information", "Debug", "Statistic", "Assert", "Unknown" },
        { "", "A fatal error occurs. The program must quit", "", "", "", "", "A failed assertion occurs", "" },
}

Definition at line 71 of file displayer.cpp.

Referenced by NLMISC::CMsgBoxDisplayer::doDisplay(), and NLMISC::IDisplayer::logTypeToString().

const uint8 NLMISC::MAX_MIPMAP = 16
 

Definition at line 70 of file bitmap.h.

Referenced by NLMISC::CBitmap::decompressDXT1(), NLMISC::CBitmap::decompressDXT3(), NLMISC::CBitmap::decompressDXT5(), NLMISC::CBitmap::releaseMipMaps(), and NLMISC::CBitmap::resizeMipMap().

const int NLMISC::MaxCStringSize = 1024*2
 

Definition at line 47 of file string_common.h.

bool NLMISC::NL3D_BlockMemoryAssertOnPurge = true
 

See CBlockMemory::Purge.

Definition at line 35 of file block_memory.cpp.

Referenced by NLMISC::CBlockMemory< CNode >::purge().

const float NLMISC::NL3D_OO255 = 1.0f / 255 [static]
 

Definition at line 41 of file noise_value.cpp.

Referenced by NLMISC::CRandomGrid3D::evalBiLinear(), and NLMISC::CRandomGrid3D::evalNearest().

CRandomGrid3D NLMISC::NL3D_RandomGrid3D [static]
 

Definition at line 207 of file noise_value.cpp.

bool NLMISC::NoAssert = false
 

Definition at line 86 of file debug.cpp.

Referenced by setAssert().

int NLMISC::OptFastFloorBkupCW
 

Definition at line 34 of file fast_floor.cpp.

int NLMISC::OptFastFloorBkupCW24
 

Definition at line 36 of file fast_floor.cpp.

double NLMISC::OptFastFloorMagicConst = pow(2,52) + pow(2,51)
 

Definition at line 33 of file fast_floor.cpp.

float NLMISC::OptFastFloorMagicConst24 = (float)pow(2,23)
 

Definition at line 35 of file fast_floor.cpp.

const double NLMISC::Pi = 3.1415926535897932384626433832795
 

Pi constant in double format.

Definition at line 79 of file common.h.

Referenced by NLLIGO::CZoneTemplate::build(), NLLIGO::CZoneEdge::buildMatrix(), NL3D::CZoneLighter::calcSkyContribution(), NL3D::CLodCharacterManager::CLodCharacterManager(), NL3D::CTargetAnimCtrl::CTargetAnimCtrl(), NL3D::CVegetableManager::CVegetableManager(), NL3D::CVegetableQuadrant::CVegetableQuadrant(), degToRad(), NLSOUND::CSourceDSound::getCone(), NL3D::CZoneLighter::getMaxPhi(), H_AUTO_DECL(), NLSOUND::CSound::importForm(), NL3D::CZoneLighter::init(), NL3D::CTessFacePriorityList::init(), NL3D::CEvent3dMouseListener::operator()(), radToDeg(), NLSOUND::CSourceDSound::setCone(), NLSOUND::CSimpleSource::setDirection(), NL3D::CPointLight::setupSpotAngle(), NL3D::CVegetableManager::setupVertexProgramConstants(), NL3D::CMeshVPWindTree::speedCos(), NLMISC::CQuatT< T >::squadrev(), and NL3D::CMiniCol::testMove().

const double NLMISC::QuatEpsilon = 0.000001
 

Definition at line 39 of file quat.h.

Referenced by NLMISC::CQuatT< T >::exp(), NLMISC::CQuatT< T >::log(), and NLMISC::CQuatT< T >::squadrev().

CStdDisplayer* NLMISC::sd = NULL [static]
 

Definition at line 98 of file debug.cpp.

Referenced by createDebug(), and initDebug2().

const int NLMISC::SEP_SIZE = 1
 

Definition at line 553 of file mem_stream.h.

Referenced by NLMISC::CStringStream::serialSeparatedBufferIn(), NLMISC::CMemStream::serialSeparatedBufferIn(), NLMISC::CStringStream::serialSeparatedBufferOut(), and NLMISC::CMemStream::serialSeparatedBufferOut().

const char NLMISC::SEPARATOR = ' '
 

Definition at line 552 of file mem_stream.h.

Referenced by NLMISC::CStringStream::serial(), NLMISC::CMemStream::serial(), NLMISC::CBitMemStream::serial(), NLMISC::CStringStream::serialSeparatedBufferIn(), NLMISC::CMemStream::serialSeparatedBufferIn(), NLMISC::CStringStream::serialSeparatedBufferOut(), NLMISC::COXml::serialSeparatedBufferOut(), and NLMISC::CMemStream::serialSeparatedBufferOut().

const char * NLMISC::SerialTypeToCStr = { "Bool ", "Ui32N", "Ui64N", "Float", "Btfld", "Buffr" }
 

Definition at line 45 of file bit_mem_stream.cpp.

Referenced by NLMISC::CBMSDbgInfo::getEventLegendAtBitPos().

map<TSharedMemId, int> NLMISC::SharedMemIdsToShmids
 

Definition at line 48 of file shared_memory.cpp.

Referenced by NLMISC::CSharedMemory::createSharedMemory(), and NLMISC::CSharedMemory::destroySharedMemory().

const CStringConversion<TKey>::CPair NLMISC::stringTable[] [static]
 

Definition at line 37 of file events.cpp.

CLog * NLMISC::WarningLog = NULL
 

Definition at line 90 of file debug.cpp.

Referenced by NLNET::cbLogFilter(), createDebug(), initDebug2(), NLNET::IService::main(), and NLMISC_COMMAND().


Generated on Tue Mar 16 13:00:38 2004 for NeL by doxygen 1.3.6