aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/print.h
blob: 061ead40ba4c1ec03b76856b4a70ae7bde562b0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef PRINT_H
#define PRINT_H

#include "cgen.h"
#include "lex.h"
#include "prv.h"
#include <stddef.h>

struct prisym
{
    enum {PRS_LIT, PRS_NAM, PRS_STR, PRS_PTR, PRS_NUM} type;
    const struct sym *s;

    union
    {
        const struct lit *lit;
        const struct stentry *e;
        const char *name;
    } u;
};

struct print
{
    struct prisym *syms;
    size_t nsyms;
    int skipln;
};

int print(const struct lex *l, struct prv *p);
int print_cgen(const struct print *pr, struct cgen *c, const char *f);
void print_free(struct print *p);

#endif