1 // Copyright 2014 PDFium Authors. All rights reserved.
\r
2 // Use of this source code is governed by a BSD-style license that can be
\r
3 // found in the LICENSE file.
\r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
\r
9 typedef FX_INT32 FWL_ERR;
\r
10 #define FWL_ERR_Succeeded 0
\r
11 #define FWL_ERR_Indefinite -1
\r
12 #define FWL_ERR_Parameter_Invalid -100
\r
13 #define FWL_ERR_Property_Invalid -200
\r
14 #define FWL_ERR_Intermediate_Value__Invalid -300
\r
15 #define FWL_ERR_Method_Not_Supported -400
\r
16 #define FWL_ERR_Out_Of_Memory -500
\r
17 #if defined (__WIN32__) || defined (_WIN32)
\r
18 #define _FWL_ALARM_IF_FAIL(arg, alarm) { if (!(arg)) ::OutputDebugString(alarm); }
\r
19 #elif defined (__linux) || defined (linux) || defined (__APPLE__) || defined (__MACOSX__)
\r
20 #define _FWL_ALARM_IF_FAIL(arg, alarm) { if (!(arg)) printf(alarm); }
\r
23 #define _FWL_RETURN_IF_FAIL(arg) { if (!(arg)) return; }
\r
24 #define _FWL_RETURN_VALUE_IF_FAIL(arg, val) { if (!(arg)) return val; }
\r
25 #define _FWL_GOTO_POSITION_IF_FAIL(arg, pos) { if (!(arg)) goto pos; }
\r
26 #if defined (__WIN32__) || defined (_WIN32)
\r
28 _FWL_ERR_CHECK_ALARM_IF_FAIL(arg) \
\r
30 if ((arg) != FWL_ERR_Succeeded) \
\r
33 sprintf(buf, "Error code is %d\n", arg); \
\r
34 ::OutputDebugString(buf); \
\r
37 #elif defined (__linux) || defined (linux) || defined (__APPLE__) || defined (__MACOSX__)
\r
39 _FWL_ERR_CHECK_ALARM_IF_FAIL(arg) \
\r
41 if ((arg) != FWL_ERR_Succeeded) \
\r
42 printf("%d\n", arg); \
\r
46 #define _FWL_ERR_CHECK_RETURN_IF_FAIL(arg) { if ((arg) != FWL_ERR_Succeeded) return; }
\r
47 #define _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(arg, val) { if ((arg) != FWL_ERR_Succeeded) return val; }
\r
48 #define _FWL_ERR_CHECK_GOTO_POSITION_IF_FAIL(arg, pos) { if ((arg) != FWL_ERR_Succeeded) goto pos; }
\r