Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
xp.h File Reference

Go to the source code of this file.

Defines

#define FALSE   false
#define TRUE   true
#define DWORD   unsigned long
#define UINT   unsigned int
#define LPSTR   char*
#define WORD   unsigned short
#define BOOL   bool

Functions

BOOL XP_IsFile (LPSTR szFileName)
 XP_WIN && !XP_OS2.
XP_HFILE XP_CreateFile (LPSTR szFileName)
XP_HFILE XP_OpenFile (LPSTR szFileName)
void XP_CloseFile (XP_HFILE hFile)
void XP_DeleteFile (LPSTR szFileName)
DWORD XP_WriteFile (XP_HFILE hFile, void *pBuf, int iSize)
void XP_FlushFileBuffers (XP_HFILE hFile)
DWORD XP_GetPrivateProfileString (LPSTR szSection, LPSTR szKey, LPSTR szDefault, LPSTR szString, DWORD dwSize, LPSTR szFileName)
int XP_GetPrivateProfileInt (LPSTR szSection, LPSTR szKey, int iDefault, LPSTR szFileName)
BOOL XP_WritePrivateProfileString (LPSTR szSection, LPSTR szKey, LPSTR szString, LPSTR szFileName)
BOOL XP_WritePrivateProfileInt (LPSTR szSection, LPSTR szKey, int iValue, LPSTR szFileName)
DWORD XP_GetTickCount ()
void XP_Sleep (DWORD dwSleepTime)

Define Documentation

#define BOOL   bool

Definition at line 244 of file xp.h.

#define DWORD   unsigned long

Definition at line 228 of file xp.h.

Definition at line 220 of file xp.h.

#define LPSTR   char*

Definition at line 236 of file xp.h.

#define TRUE   true

Definition at line 224 of file xp.h.

#define UINT   unsigned int

Definition at line 232 of file xp.h.

#define WORD   unsigned short

Definition at line 240 of file xp.h.


Function Documentation

Definition at line 88 of file utils.cpp.

{
  if(hFile != NULL)
  {
#ifdef XP_WIN
    CloseHandle((HANDLE)hFile);
#else
    fclose(hFile);
#endif
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

XP_HFILE XP_CreateFile ( LPSTR  szFileName)

Definition at line 79 of file xp.cpp.

{
#ifdef XP_WIN
  OFSTRUCT of;
  HFILE hFile = OpenFile(szFileName, &of, OF_CREATE | OF_WRITE);
  return (hFile != HFILE_ERROR) ? hFile : NULL;
#else
  return (XP_HFILE)fopen(szFileName, "w+");
#endif // XP_WIN
}

Here is the call graph for this function:

void XP_DeleteFile ( LPSTR  szFileName)

Definition at line 66 of file xp.cpp.

{
#ifdef XP_WIN
  DeleteFile(szFileName);
  return;
#endif // XP_WIN

#if (defined XP_UNIX || defined XP_MAC || defined XP_OS2)
  remove(szFileName);
  return;
#endif // XP_UNIX || XP_MAC || XP_OS2
}

Definition at line 111 of file utils.cpp.

{
#ifdef XP_WIN
  FlushFileBuffers((HANDLE)hFile);
#else
  fflush(hFile);
#endif 
}

Here is the call graph for this function:

Here is the caller graph for this function:

int XP_GetPrivateProfileInt ( LPSTR  szSection,
LPSTR  szKey,
int  iDefault,
LPSTR  szFileName 
)

Definition at line 166 of file xp.cpp.

{
#ifdef XP_WIN
  return GetPrivateProfileInt(szSection, szKey, iDefault, szFileName);
#else
  static char szString[80];
  XP_GetPrivateProfileString(szSection, szKey, "", szString, sizeof(szString), szFileName);
  if(!*szString)
    return iDefault;
  int iRet = atoi(szString);
  return iRet;
#endif // XP_WIN
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD XP_GetPrivateProfileString ( LPSTR  szSection,
LPSTR  szKey,
LPSTR  szDefault,
LPSTR  szString,
DWORD  dwSize,
LPSTR  szFileName 
)

Definition at line 148 of file xp.cpp.

{
#ifdef XP_WIN
  return GetPrivateProfileString(szSection, szKey, szDefault, szString, dwSize, szFileName);
#else
  XP_HFILE hFile = XP_OpenFile(szFileName);
  if(hFile == NULL)
  {
    strcpy(szString, szDefault);
    int iRet = strlen(szString);
    return iRet;
  }
  DWORD dwRet = PP_GetString(szSection, szKey, szDefault, szString, dwSize, hFile);
  XP_CloseFile(hFile);
  return dwRet;
#endif // XP_WIN
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 212 of file xp.cpp.

{
#ifdef XP_WIN
  return GetTickCount();
#else
  return (DWORD)0;
#endif // XP_WIN
}

Here is the caller graph for this function:

BOOL XP_IsFile ( LPSTR  szFileName)

XP_WIN && !XP_OS2.

Definition at line 51 of file xp.cpp.

{
#ifdef XP_WIN
  OFSTRUCT of;
  return (HFILE_ERROR != OpenFile(szFileName, &of, OF_EXIST));
#endif
#if defined(XP_UNIX) || defined(XP_OS2)
  struct stat s;
  return (stat(szFileName, &s) != -1);
#endif
#ifdef XP_MAC /*  HACK */
       return 1;
#endif
}

Here is the call graph for this function:

XP_HFILE XP_OpenFile ( LPSTR  szFileName)

Definition at line 90 of file xp.cpp.

{
#ifdef XP_WIN
  OFSTRUCT of;
  HFILE hFile = OpenFile(szFileName, &of, OF_READ | OF_WRITE);
  return (hFile != HFILE_ERROR) ? hFile : NULL;
#else
  return (XP_HFILE)fopen(szFileName, "r+");
#endif // XP_WIN
}

Here is the call graph for this function:

void XP_Sleep ( DWORD  dwSleepTime)

Definition at line 221 of file xp.cpp.

{
  if((long)dwSleepTime <= 0L)
    return;

#ifdef XP_WIN
  Sleep(dwSleepTime);
#endif // XP_WIN
}

Here is the caller graph for this function:

DWORD XP_WriteFile ( XP_HFILE  hFile,
void pBuf,
int  iSize 
)

Definition at line 100 of file utils.cpp.

{
#ifdef XP_WIN
  DWORD dwRet;
  WriteFile((HANDLE)hFile, pBuf, iSize, &dwRet, NULL);
  return dwRet;
#else
  return (DWORD)fwrite(pBuf, iSize, 1, hFile);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL XP_WritePrivateProfileInt ( LPSTR  szSection,
LPSTR  szKey,
int  iValue,
LPSTR  szFileName 
)

Definition at line 198 of file xp.cpp.

{
  char szString[80];
  _itoa(iValue, szString, 10);
  return XP_WritePrivateProfileString(szSection, szKey, szString, szFileName);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL XP_WritePrivateProfileString ( LPSTR  szSection,
LPSTR  szKey,
LPSTR  szString,
LPSTR  szFileName 
)

Definition at line 180 of file xp.cpp.

{
#ifdef XP_WIN
  return WritePrivateProfileString(szSection, szKey, szString, szFileName);
#else
  XP_HFILE hFile = XP_OpenFile(szFileName);
  if(hFile == NULL)
  {
    hFile = XP_CreateFile(szFileName);
    if(hFile == NULL)
      return FALSE;
  }
  BOOL bRet = PP_WriteString(szSection, szKey, szString, hFile);
  XP_CloseFile(hFile);
  return bRet;
#endif // XP_WIN
}

Here is the call graph for this function:

Here is the caller graph for this function: