atoms.c 460 Bytes
Newer Older
Niels Möller's avatar
Niels Möller committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* atoms.c
 *
 */

#include "atoms.h"

#include "atoms_gperf.c"

struct atom_rassoc
{
  UINT8 *name;
  UINT32 length;
};

struct atom_rassoc atom_table[] =
#include "atoms_table.c"
;

UINT32 get_atom_length(int atom)
{ return atom_table[atom].length; }

UINT8 *get_atom_name(int atom)
{ return atom_table[atom].name; }
  
25
UINT32 lookup_atom(UINT32 length, UINT8 *name)
Niels Möller's avatar
Niels Möller committed
26
27
28
29
30
31
32
{
  struct atom_assoc *pair = gperf_atom(name, length);

  return pair ? pair->id : 0;
}