blob: 10ccd6a0b3271f608d2daec3f95c1a7bfcea1f18 (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <stdio.h>
#include <ctype.h>
#include "types.h"
lw_unit lw_unit_v = {};
void lw_writec(char c) {
fputc(c, stdout);
}
void lw_write(const char* s) {
fputs(s, stdout);
}
char *lw_Basis_attrifyInt(lw_Basis_int n) {
return "0";
}
char *lw_Basis_attrifyFloat(lw_Basis_float n) {
return "0.0";
}
char *lw_Basis_attrifyString(lw_Basis_string s) {
return "";
}
char *lw_Basis_attrifyInt_w(lw_Basis_int n) {
printf("%d", n);
}
char *lw_Basis_attrifyFloat_w(lw_Basis_float n) {
printf("%g", n);
}
char *lw_Basis_attrifyString_w(lw_Basis_string s) {
for (; *s; s++) {
char c = *s;
if (c == '"')
lw_write(""");
else if (isprint(c))
lw_writec(c);
else {
lw_write("&#");
lw_Basis_attrifyInt_w(c);
lw_writec(';');
}
}
lw_write(s);
}
|