2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
14 typedef struct setnode
22 static setnode
*new_setnode(const char *name
, setnode
*next
, int off
, long pri
){
25 if (!(n
= calloc(1, sizeof(setnode
))) ||
26 !(n
->secname
= strdup(name
))
29 fatal("new_setnode()", strerror(errno
));
39 static setnode
*get_setnode(setnode
**list
, const char *name
, int off
, long pri
)
41 setnode
**curr
= list
;
45 if (strcmp((*curr
)->secname
, name
) == 0)
49 if ((*curr
)->pri
== pri
)
52 if ((*curr
)->pri
> pri
)
55 curr
= &(*curr
)->next
;
57 } while (*curr
&& strcmp((*curr
)->secname
, name
) == 0);
62 curr
= &(*curr
)->next
;
65 return (*curr
= new_setnode(name
, *curr
, off
, pri
));
68 void emit_sets(setnode
*setlist
, FILE *out
)
70 char setname_big
[201];
75 setnode
*oldnode
= setlist
;
80 setname_big
[i
] = toupper(setlist
->secname
[setlist
->off_setname
+ i
]);
81 } while (setlist
->secname
[setlist
->off_setname
+ i
++]);
87 " %s((__%s_END__ - __%s_LIST__) / %d - 2)\n",
88 setname_big
, sizeof(long)==4?"LONG":"QUAD", setname_big
, setname_big
, sizeof(long)
97 setlist
->secname
, setlist
->pri
100 setlist
= setlist
->next
;
101 } while (setlist
&& (strcmp(oldnode
->secname
, setlist
->secname
) == 0));
109 " __%s_END__ = .;\n",
110 oldnode
->secname
, sizeof(long)==4?"LONG":"QUAD", setname_big
116 void parse_secname(const char *secname
, setnode
**setlist_ptr
)
122 if (strncmp(secname
, ".aros.set.", 10) == 0)
125 if (strncmp(secname
, ".ctors", 5) == 0)
128 if (strncmp(secname
, ".dtors", 5) == 0)
133 idx
= strchr(secname
+ off
, '.');
137 pri
= strtol(&idx
[1], NULL
, 10);
140 get_setnode(setlist_ptr
, secname
, off
, pri
);