DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T m

⟦7e0e3bc90⟧ TextFile

    Length: 1023 (0x3ff)
    Types: TextFile
    Names: »msgs.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Adv/Compiler/msgs.c« 

TextFile

#include	"advgen.h"

static int	nmsgs = 1;
static char	*msgs[MAXMSGS] = { "Enjoy your adventure!" };

void
decl_msg(s, m)
    symbol	*s;
    char	*m;
{
    switch (s->s_type)
    {
	case S_MSG:
	    muldecl(s->s_sym, "message");
	    break;
	case S_UNKNOWN:
	    if (nmsgs == MAXMSGS)
	    {
		fatal("too many messages");
	    }
	    msgs[nmsgs] = m;
	    s->s_type = S_MSG;
	    s->s_value = nmsgs++;
	    break;
	default:
	    confdecl(s->s_sym, "message", s->s_type);
	    break;
    }
}

symbol *
anon_msg(m)
    char	*m;
{
    static symbol	s;
    int			i;

    for (i=0; i<nmsgs; i++)
    {
	if (streq(m, msgs[i]))
	{
	    s.s_value = i;
	    return &s;
	}
    }
    if (nmsgs == MAXMSGS)
    {
	fatal("too many messages");
    }
    msgs[nmsgs] = m;
    s.s_value = nmsgs++;
    s.s_type = S_MSG;
    return &s;
}

void
greetmsg(m)
    char	*m;
{
    msgs[0] = m;
}

void
printmsgs(f)
    FILE	*f;
{
    int		i;

    fprintf(f, "%d\n", nmsgs);
    for (i=0; i<nmsgs; i++)
    {
	fprintf(f, "%s\n", msgs[i]);
    }
}