25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
*/
#include <stdio.h>
#include "object.h"
#include "string.h"
#include "array.h"
int
main()
{
CFWString *s[3];
CFWArray *a;
size_t i;
s[0] = cfw_new(cfw_string, "Hallo");
s[1] = cfw_new(cfw_string, " Welt");
s[2] = cfw_new(cfw_string, "!");
a = cfw_new(cfw_array, s[0], s[1], s[2], NULL);
|
>
>
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
*/
#include <stdio.h>
#include "object.h"
#include "string.h"
#include "array.h"
#include "map.h"
int
main()
{
CFWString *s[3];
CFWArray *a;
CFWMap *m;
size_t i;
s[0] = cfw_new(cfw_string, "Hallo");
s[1] = cfw_new(cfw_string, " Welt");
s[2] = cfw_new(cfw_string, "!");
a = cfw_new(cfw_array, s[0], s[1], s[2], NULL);
|
57
58
59
60
61
62
63
64
65
66
|
puts(cfw_string_c(s[0]));
s[1] = cfw_new(cfw_string, "ll");
printf("%zd\n", cfw_string_find(s[0], s[1], cfw_range_all));
cfw_unref(s[1]);
cfw_unref(s[0]);
return 0;
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
puts(cfw_string_c(s[0]));
s[1] = cfw_new(cfw_string, "ll");
printf("%zd\n", cfw_string_find(s[0], s[1], cfw_range_all));
cfw_unref(s[1]);
cfw_unref(s[0]);
s[0] = cfw_new(cfw_string, "Hallo");
s[1] = cfw_new(cfw_string, "Welt!");
m = cfw_new(cfw_map, s[0], s[1], NULL);
cfw_unref(s[1]);
puts(cfw_string_c(cfw_map_get(m, s[0])));
s[1] = cfw_new(cfw_string, "Test");
cfw_map_set(m, s[0], s[1]);
cfw_unref(s[1]);
puts(cfw_string_c(cfw_map_get(m, s[0])));
cfw_map_set(m, s[0], NULL);
printf("%p\n", cfw_map_get(m, s[0]));
cfw_unref(s[0]);
cfw_unref(m);
return 0;
}
|