source: rxuls/trunk/tests/attr.c@ 28

Last change on this file since 28 was 28, checked in by Alex Taylor, 10 years ago

Initial import of RXULS.

File size: 1.4 KB
Line 
1#include <stdio.h>
2#include <unidef.h>
3
4int main(void) {
5
6 LocaleObject locale_object = NULL;
7 AttrObject attr_object = NULL;
8 int result = 0;
9 int rc = ULS_SUCCESS;
10 size_t offset = 0;
11 UniChar *uni_char = L"os2";
12
13 /*****************************************************************/
14 /* Assumes LANG environment variable set to a valid locale name, */
15 /* such as fr_FR */
16 /*****************************************************************/
17 rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
18 (UniChar *)L"", &locale_object);
19 if (rc != ULS_SUCCESS) {
20 printf("UniCreateLocaleObject error: return code = %u\n", rc);
21 return 1;
22 }
23
24 /* Create an attribute object */
25 rc = UniCreateAttrObject(locale_object,
26 (UniChar *)L"digit", &attr_object);
27 if (rc != ULS_SUCCESS) {
28 printf("UniCreateAttrObject error: return code = %u\n", rc);
29 return 1;
30 }
31
32 /* Make call to determine if string matches attributes */
33 rc = UniScanForAttr(attr_object, uni_char, UniStrlen(uni_char),
34 FALSE, &offset);
35 if (rc != ULS_SUCCESS) {
36 printf("UniScanForAttr error: return code = %u\n", rc);
37 return 1;
38 }
39 printf("%d\n", offset );
40 return ULS_SUCCESS;
41}
Note: See TracBrowser for help on using the repository browser.