ack/util/grind/langdep.cc

54 lines
763 B
C++
Raw Normal View History

1990-08-31 18:22:53 +00:00
/* $Header$ */
#include "langdep.h"
struct langlist {
struct langlist *l_next;
struct langdep *l_lang;
char *l_suff;
};
/* STATICALLOCDEF "langlist" 5 */
static struct langlist *list;
struct langdep *currlang;
1990-11-12 13:46:31 +00:00
static void
1990-08-31 18:22:53 +00:00
add_language(suff, lang)
char *suff;
struct langdep *lang;
{
struct langlist *p = new_langlist();
p->l_next = list;
p->l_suff = suff;
p->l_lang = lang;
list = p;
}
init_languages()
{
add_language(".mod", m2_dep);
1990-09-14 14:37:26 +00:00
add_language(".c", c_dep);
1990-08-31 18:22:53 +00:00
}
find_language(suff)
char *suff;
{
register struct langlist *p = list;
1990-09-20 17:51:14 +00:00
if (! suff) {
currlang = c_dep;
return;
}
1990-08-31 18:22:53 +00:00
while (p) {
currlang = p->l_lang;
if (! strcmp(p->l_suff, suff)) break;
p = p->l_next;
}
1990-09-12 16:13:59 +00:00
if (! currlang) {
1990-09-19 14:31:12 +00:00
currlang = c_dep;
1990-09-12 16:13:59 +00:00
}
1990-08-31 18:22:53 +00:00
}