sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
pserror.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * pserror.h
4 *
5 * Adobe's code for error handling (specification).
6 *
7 * Copyright 2006-2013 Adobe Systems Incorporated.
8 *
9 * This software, and all works of authorship, whether in source or
10 * object code form as indicated by the copyright notice(s) included
11 * herein (collectively, the "Work") is made available, and may only be
12 * used, modified, and distributed under the FreeType Project License,
13 * LICENSE.TXT. Additionally, subject to the terms and conditions of the
14 * FreeType Project License, each contributor to the Work hereby grants
15 * to any individual or legal entity exercising permissions granted by
16 * the FreeType Project License and this section (hereafter, "You" or
17 * "Your") a perpetual, worldwide, non-exclusive, no-charge,
18 * royalty-free, irrevocable (except as stated in this section) patent
19 * license to make, have made, use, offer to sell, sell, import, and
20 * otherwise transfer the Work, where such license applies only to those
21 * patent claims licensable by such contributor that are necessarily
22 * infringed by their contribution(s) alone or by combination of their
23 * contribution(s) with the Work to which such contribution(s) was
24 * submitted. If You institute patent litigation against any entity
25 * (including a cross-claim or counterclaim in a lawsuit) alleging that
26 * the Work or a contribution incorporated within the Work constitutes
27 * direct or contributory patent infringement, then any patent licenses
28 * granted to You under this License for that Work shall terminate as of
29 * the date such litigation is filed.
30 *
31 * By using, modifying, or distributing the Work you indicate that you
32 * have read and understood the terms and conditions of the
33 * FreeType Project License as well as those provided in this section,
34 * and you accept them fully.
35 *
36 */
37
38
43#ifndef PSERROR_H_
44#define PSERROR_H_
45
46
47#include <freetype/ftmoderr.h>
48
49#undef FTERRORS_H_
50
51#undef FT_ERR_PREFIX
52#define FT_ERR_PREFIX CF2_Err_
53#define FT_ERR_BASE FT_Mod_Err_CF2
54
55
56#include <freetype/fterrors.h>
58#include "psft.h"
59
60
61FT_BEGIN_HEADER
62
63
64 /*
65 * A poor-man error facility.
66 *
67 * This code being written in vanilla C, doesn't have the luxury of a
68 * language-supported exception mechanism such as the one available in
69 * Java. Instead, we are stuck with using error codes that must be
70 * carefully managed and preserved. However, it is convenient for us to
71 * model our error mechanism on a Java-like exception mechanism.
72 * When we assign an error code we are thus `throwing' an error.
73 *
74 * The preservation of an error code is done by coding convention.
75 * Upon a function call if the error code is anything other than
76 * `FT_Err_Ok', which is guaranteed to be zero, we
77 * will return without altering that error. This will allow the
78 * error to propagate and be handled at the appropriate location in
79 * the code.
80 *
81 * This allows a style of code where the error code is initialized
82 * up front and a block of calls are made with the error code only
83 * being checked after the block. If a new error occurs, the original
84 * error will be preserved and a functional no-op should result in any
85 * subsequent function that has an initial error code not equal to
86 * `FT_Err_Ok'.
87 *
88 * Errors are encoded by calling the `FT_THROW' macro. For example,
89 *
90 * {
91 * FT_Error e;
92 *
93 *
94 * ...
95 * e = FT_THROW( Out_Of_Memory );
96 * }
97 *
98 */
99
100
101 /* Set error code to a particular value. */
102 FT_LOCAL( void )
103 cf2_setError( FT_Error* error,
104 FT_Error value );
105
106
107 /*
108 * A macro that conditionally sets an error code.
109 *
110 * This macro will first check whether `error' is set;
111 * if not, it will set it to `e'.
112 *
113 */
114#define CF2_SET_ERROR( error, e ) \
115 cf2_setError( error, FT_THROW( e ) )
116
117
118FT_END_HEADER
119
120
121#endif /* PSERROR_H_ */
122
123
124/* END */