1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | http://www.php.net/license/3_01.txt                                  |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Gustavo Lopes <cataphract@php.net>                          |
14    +----------------------------------------------------------------------+
15  */
16 
17 #include "codepointiterator_internal.h"
18 
19 extern "C" {
20 #define USE_BREAKITERATOR_POINTER 1
21 #include "breakiterator_class.h"
22 }
23 
24 using PHP::CodePointBreakIterator;
25 
fetch_cpbi(BreakIterator_object * bio)26 static inline CodePointBreakIterator *fetch_cpbi(BreakIterator_object *bio) {
27 	return (CodePointBreakIterator*)bio->biter;
28 }
29 
PHP_FUNCTION(cpbi_get_last_code_point)30 U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point)
31 {
32 	BREAKITER_METHOD_INIT_VARS;
33 	object = getThis();
34 
35 	if (zend_parse_parameters_none() == FAILURE) {
36 		intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
37 			"cpbi_get_last_code_point: bad arguments", 0);
38 		RETURN_FALSE;
39 	}
40 
41 	BREAKITER_METHOD_FETCH_OBJECT;
42 
43 	RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint());
44 }
45