|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
| 17 | +#include <SBBase.h> |
| 18 | +#include <SBCodepointSequence.h> |
17 | 19 | #include <SFConfig.h> |
18 | | -#include <stddef.h> |
19 | 20 |
|
20 | 21 | #include "SFAssert.h" |
21 | 22 | #include "SFBase.h" |
22 | 23 | #include "SFCodepoints.h" |
23 | 24 |
|
| 25 | +SF_INTERNAL SFCodepoint SFCodepointsGetMirror(SFCodepoint codepoint) |
| 26 | +{ |
| 27 | + SFCodepoint mirror = SBCodepointGetMirror(codepoint); |
| 28 | + if (!mirror) { |
| 29 | + return codepoint; |
| 30 | + } |
| 31 | + |
| 32 | + return mirror; |
| 33 | +} |
| 34 | + |
24 | 35 | SF_INTERNAL void SFCodepointsInitialize(SFCodepointsRef codepoints, const SBCodepointSequence *referral, SFBoolean backward) |
25 | 36 | { |
26 | | - codepoints->referral = referral; |
| 37 | + codepoints->_referral = referral; |
| 38 | + codepoints->_token = SFInvalidIndex; |
27 | 39 | codepoints->index = SFInvalidIndex; |
28 | 40 | codepoints->backward = backward; |
29 | 41 | } |
30 | 42 |
|
31 | 43 | SF_INTERNAL void SFCodepointsReset(SFCodepointsRef codepoints) |
32 | 44 | { |
33 | | - codepoints->index = (!codepoints->backward ? 0 : codepoints->referral->stringLength); |
| 45 | + codepoints->_token = (!codepoints->backward ? 0 : codepoints->_referral->stringLength); |
34 | 46 | } |
35 | 47 |
|
36 | 48 | SF_INTERNAL SFCodepoint SFCodepointsNext(SFCodepointsRef codepoints) |
37 | 49 | { |
| 50 | + SFCodepoint current; |
| 51 | + |
38 | 52 | if (!codepoints->backward) { |
39 | | - return SBCodepointSequenceGetCodepointAt(codepoints->referral, &codepoints->index); |
| 53 | + codepoints->index = codepoints->_token; |
| 54 | + current = SBCodepointSequenceGetCodepointAt(codepoints->_referral, &codepoints->_token); |
| 55 | + } else { |
| 56 | + current = SBCodepointSequenceGetCodepointBefore(codepoints->_referral, &codepoints->_token); |
| 57 | + codepoints->index = codepoints->_token; |
40 | 58 | } |
41 | 59 |
|
42 | | - return SBCodepointSequenceGetCodepointBefore(codepoints->referral, &codepoints->index); |
| 60 | + return current; |
43 | 61 | } |
0 commit comments