1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef _FX_SYSTEM
8 #define _FX_SYSTEM
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 #define FX_RAD2DEG(r) ((r)*180.0f / FX_PI)
13 #define FX_DEG2RAD(a) ((a)*FX_PI / 180.0f)
14 typedef int8_t* FX_LPINT8;
15 typedef int8_t const* FX_LPCINT8;
16 typedef int32_t* FX_LPINT32;
17 typedef int32_t const* FX_LPCINT32;
18 typedef long FX_LONG;
19 typedef FX_LONG* FX_LPLONG;
20 typedef FX_LONG const* FX_LPCLONG;
21 typedef FX_FLOAT const* FX_LPCFLOAT;
22 typedef double FX_DOUBLE;
23 typedef FX_DOUBLE* FX_LPDOUBLE;
24 typedef FX_DOUBLE const* FX_LPCDOUBLE;
25 FX_FLOAT FX_tan(FX_FLOAT a);
26 FX_FLOAT FX_log(FX_FLOAT b, FX_FLOAT x);
27 FX_FLOAT FX_strtof(const FX_CHAR* pcsStr,
28                    int32_t iLength = -1,
29                    int32_t* pUsedLen = NULL);
30 FX_FLOAT FX_wcstof(const FX_WCHAR* pwsStr,
31                    int32_t iLength = -1,
32                    int32_t* pUsedLen = NULL);
33 FX_WCHAR* FX_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count);
34 int32_t FX_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count);
35 int32_t FX_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count);
FX_islower(int32_t ch)36 inline FX_BOOL FX_islower(int32_t ch) {
37   return ch >= 'a' && ch <= 'z';
38 }
FX_isupper(int32_t ch)39 inline FX_BOOL FX_isupper(int32_t ch) {
40   return ch >= 'A' && ch <= 'Z';
41 }
FX_tolower(int32_t ch)42 inline int32_t FX_tolower(int32_t ch) {
43   return FX_isupper(ch) ? (ch + 0x20) : ch;
44 }
FX_toupper(int32_t ch)45 inline int32_t FX_toupper(int32_t ch) {
46   return FX_islower(ch) ? (ch - 0x20) : ch;
47 }
48 int32_t FX_filelength(FXSYS_FILE* file);
49 FX_BOOL FX_fsetsize(FXSYS_FILE* file, int32_t size);
50 void FX_memset(void* pBuf, int32_t iValue, size_t size);
51 void FX_memcpy(void* pDst, const void* pSrc, size_t size);
52 FX_BOOL FX_IsRelativePath(const CFX_WideStringC& wsPath);
53 FX_BOOL FX_JoinPath(const CFX_WideStringC& wsBasePath,
54                     const CFX_WideStringC& wsRelativePath,
55                     CFX_WideString& wsAbsolutePath);
56 typedef struct _FX_VERSION {
57   FX_DWORD dwMajorVersion;
58   FX_DWORD dwMinorVersion;
59   FX_DWORD dwBuildVersion;
60 } FX_VERSION, *FX_LPVERSION;
61 typedef FX_VERSION const* FX_LPCVERSION;
62 #ifdef __cplusplus
63 };
64 #endif
65 #endif
66