1 #include "csf.h"
2 #include "csfimpl.h"
3
4 /* get the attribute control block (LIBRARY_INTERNAL)
5 * GetAttrBlock searches for the attribute control block
6 * that keeps the information for the given id.
7 * returns
8 * 0 if attribute is not found,
9 * or if found, the file position of the attribute
10 * control block.
11 */
CsfGetAttrBlock(MAP * m,CSF_ATTR_ID id,ATTR_CNTRL_BLOCK * b)12 CSF_FADDR32 CsfGetAttrBlock(
13 MAP *m, /* map handle */
14 CSF_ATTR_ID id, /* identification of the attribute */
15 ATTR_CNTRL_BLOCK *b) /* write-only, attribute control block containing
16 * the id information.
17 */
18 {
19 CSF_FADDR32 next;
20
21 next = m->main.attrTable;
22 while (next != 0 )
23 {
24 CsfReadAttrBlock(m, next, b);
25 if (CsfGetAttrIndex(id, b) != NR_ATTR_IN_BLOCK)
26 break;
27 next = b->next;
28 }
29 return(next);
30 }
31
32 /* get the attribute position and size (LIBRARY_INTERNAL)
33 * CsfGetAttrPosSize searches the attribute control block list
34 * that keeps the information for the given id.
35 * returns
36 * 0 if attribute is not found,
37 * or if found, the file position of the attribute.
38 */
CsfGetAttrPosSize(MAP * m,CSF_ATTR_ID id,size_t * size)39 CSF_FADDR32 CsfGetAttrPosSize(
40 MAP *m, /* map handle */
41 CSF_ATTR_ID id, /* identification of the attribute */
42 size_t *size) /* write-only the size of the attribute */
43 {
44 ATTR_CNTRL_BLOCK b;
45 int i;
46
47 if (CsfGetAttrBlock(m,id, &b) == 0)
48 return 0;
49
50 i = CsfGetAttrIndex(id, &b);
51 *size = b.attrs[i].attrSize;
52 return b.attrs[i].attrOffset;
53 }
54