version 1.3, 2015/07/21 03:26:22 |
version 1.4, 2015/07/25 14:02:06 |
|
|
|
|
struct tag_entry { |
struct tag_entry { |
size_t line; |
size_t line; |
|
int prio; |
char s[]; |
char s[]; |
}; |
}; |
|
|
|
|
* or 0 if the term is unknown. |
* or 0 if the term is unknown. |
*/ |
*/ |
size_t |
size_t |
tag_get(const char *s, size_t len) |
tag_get(const char *s, size_t len, int prio) |
{ |
{ |
struct tag_entry *entry; |
struct tag_entry *entry; |
const char *end; |
const char *end; |
Line 94 tag_get(const char *s, size_t len) |
|
Line 95 tag_get(const char *s, size_t len) |
|
end = s + len; |
end = s + len; |
slot = ohash_qlookupi(&tag_data, s, &end); |
slot = ohash_qlookupi(&tag_data, s, &end); |
entry = ohash_find(&tag_data, slot); |
entry = ohash_find(&tag_data, slot); |
return(entry == NULL ? 0 : entry->line); |
return((entry == NULL || prio < entry->prio) ? 0 : entry->line); |
} |
} |
|
|
/* |
/* |
* Set the line number where a term is defined. |
* Set the line number where a term is defined. |
*/ |
*/ |
void |
void |
tag_put(const char *s, size_t len, size_t line) |
tag_put(const char *s, size_t len, int prio, size_t line) |
{ |
{ |
struct tag_entry *entry; |
struct tag_entry *entry; |
const char *end; |
const char *end; |
Line 121 tag_put(const char *s, size_t len, size_t line) |
|
Line 122 tag_put(const char *s, size_t len, size_t line) |
|
ohash_insert(&tag_data, slot, entry); |
ohash_insert(&tag_data, slot, entry); |
} |
} |
entry->line = line; |
entry->line = line; |
|
entry->prio = prio; |
} |
} |
|
|
/* |
/* |