Lines Matching defs:map

51 static int processFile(EventTagMap* map);
52 static int countMapLines(const EventTagMap* map);
53 static int parseMapLines(EventTagMap* map);
55 static int sortTags(EventTagMap* map);
59 * Open the map file and allocate a structure to manage it.
76 fprintf(stderr, "%s: unable to open map '%s': %s\n",
84 fprintf(stderr, "%s: unable to seek map '%s'\n", OUT_TAG, fileName);
110 * Close the map.
112 void android_closeEventTagMap(EventTagMap* map)
114 if (map == NULL)
117 munmap(map->mapAddr, map->mapLen);
118 free(map);
122 * Look up an entry in the map.
126 const char* android_lookupEventTag(const EventTagMap* map, int tag)
131 hi = map->numTags-1;
137 cmp = map->tagArray[mid].tagIndex - tag;
146 return map->tagArray[mid].tagStr;
186 static int processFile(EventTagMap* map)
189 map->numTags = countMapLines(map);
190 if (map->numTags < 0)
193 //printf("+++ found %d tags\n", map->numTags);
196 map->tagArray = calloc(1, sizeof(EventTag) * map->numTags);
197 if (map->tagArray == NULL)
201 if (parseMapLines(map) != 0) {
207 if (sortTags(map) != 0)
223 static int countMapLines(const EventTagMap* map)
229 cp = (const char*) map->mapAddr;
230 endp = cp + map->mapLen;
260 static int parseMapLines(EventTagMap* map)
266 cp = (char*) map->mapAddr;
267 endp = cp + map->mapLen;
271 fprintf(stderr, "%s: map file missing EOL on last line\n", OUT_TAG);
289 if (tagNum >= map->numTags) {
294 if (scanTagLine(&cp, &map->tagArray[tagNum], lineNum) != 0)
313 if (tagNum != map->numTags) {
315 OUT_TAG, tagNum, map->numTags);
405 static int sortTags(EventTagMap* map)
409 qsort(map->tagArray, map->numTags, sizeof(EventTag), compareEventTags);
411 for (i = 1; i < map->numTags; i++) {
412 if (map->tagArray[i].tagIndex == map->tagArray[i-1].tagIndex) {
415 map->tagArray[i].tagIndex, map->tagArray[i].tagStr,
416 map->tagArray[i-1].tagIndex, map->tagArray[i-1].tagStr);