Overview
Comment: | Add map. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1965a6ab9e5398d6b478ba4a8d6c21ee |
User & Date: | js on 2012-04-22 02:34:54 |
Original User & Date: | js on 2012-04-22 02:34:55 |
Other Links: | manifest | tags |
Context
2012-04-22
| ||
02:34 | Add map iteration. check-in: c339f2040e user: js tags: trunk | |
02:34 | Add map. check-in: 1965a6ab9e user: js tags: trunk | |
02:34 | Add missing NULL. check-in: c3a601908a user: js tags: trunk | |
Changes
Modified src/Makefile from [b46de62f05] to [93ec1092c3].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | + | SHARED_LIB = ${LIB_PREFIX}corefw${LIB_SUFFIX} LIB_MAJOR = 0 LIB_MINOR = 0 SRCS = array.c \ class.c \ map.c \ object.c \ range.c \ string.c INCLUDES = ${SRCS:.c=.h} \ corefw.h \ hash.h |
︙ |
Added src/map.c version [3404c5c5db].
Added src/map.h version [e09d13811e].
Modified tests/tests.c from [fede98c922] to [9dfdb6f41e].
︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 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 | 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; } |