summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base_cgen.c2
-rwxr-xr-xbuild.sh2
-rw-r--r--identifiers.c8
-rw-r--r--out.c6
-rw-r--r--out.h4
-rw-r--r--test.toc4
6 files changed, 10 insertions, 16 deletions
diff --git a/base_cgen.c b/base_cgen.c
index b13012c..817354f 100644
--- a/base_cgen.c
+++ b/base_cgen.c
@@ -99,8 +99,6 @@ static bool cgen_ident(CGenerator *g, Identifier i, Location *where) {
}
}
cgen_indent(g);
- fprint_ident(stdout, i);
- printf("\n");
fprint_ident_ascii(cgen_writing_to(g), i);
return true;
}
diff --git a/build.sh b/build.sh
index bf4b3d8..2ca4c4f 100755
--- a/build.sh
+++ b/build.sh
@@ -7,7 +7,7 @@ CC=gcc
# - must be set if the zero value of a pointer (as might be set by calloc/memset)
# is not the NULL pointer.
-ADDITIONAL_FLAGS=
+ADDITIONAL_FLAGS=''
WARNINGS='-Wall -Wextra -Wpedantic -Wconversion -Wshadow'
DEBUG_FLAGS="-O0 -g3 $WARNINGS -std=c11"
diff --git a/identifiers.c b/identifiers.c
index 93c7eb6..c71ee4b 100644
--- a/identifiers.c
+++ b/identifiers.c
@@ -97,7 +97,6 @@ static Identifier ident_insert(Identifiers *ids, char **s) {
assert(c >= 0 && c <= 255);
unsigned char c_low = (unsigned char)(c & 0xf);
unsigned char c_high = (unsigned char)(c >> 4);
- printf("inserting %d as %d = %d, %d\n", **s, c, c_low, c_high);
if (!tree->children[c_low]) {
tree->children[c_low] = ident_new(ids, tree, c_low);
}
@@ -125,16 +124,13 @@ static void fprint_ident(FILE *out, Identifier id) {
static void fprint_ident_ascii(FILE *out, Identifier id) {
assert(id);
if (id->parent == NULL) return; /* at root */
- fprint_ident(out, id->parent->parent); /* to go up one character, we need to go to the grandparent */
+ fprint_ident_ascii(out, id->parent->parent); /* to go up one character, we need to go to the grandparent */
int c_low = id->parent->index_in_parent;
int c_high = id->index_in_parent;
int c = c_low + (c_high << 4);
- printf("Got %d as %d, %d\n", c, c_low, c_high);
if (c > 127) {
- puts("x thing");
fprintf(out, "x__%x",c);
} else {
- printf("single char %d\n",c);
fputc(ident_uchar_to_char(c), out);
}
}
@@ -143,7 +139,7 @@ static void fprint_ident_ascii(FILE *out, Identifier id) {
static Identifier ident_get(Identifiers *ids, const char *s) {
IdentTree *tree = ids->root;
while (*s) {
- int c = (*s) - CHAR_MIN;
+ int c = ident_char_to_uchar(*s);
assert(c >= 0 && c <= 255);
unsigned char c_low = (unsigned char)(c & 0xf);
unsigned char c_high = (unsigned char)(c >> 4);
diff --git a/out.c b/out.c
index 49ba6b7..fdcede3 100644
--- a/out.c
+++ b/out.c
@@ -1,10 +1,10 @@
#include "out.h"
/* toc */
-void x__a8(void) {
+void x__c5x__b3x__c5x__84x__c4x__a8x__f0x__9fx__90x__9f(void) {
}
-void main(void) {
- x__a8();
+void main__(void) {
+ x__c5x__b3x__c5x__84x__c4x__a8x__f0x__9fx__90x__9f();
}
int main(void) {
diff --git a/out.h b/out.h
index 23bf38f..bd89a1f 100644
--- a/out.h
+++ b/out.h
@@ -1,4 +1,4 @@
#include <stddef.h>
#include <stdint.h>
-void x__a8(void);
-void main(void);
+void x__c5x__b3x__c5x__84x__c4x__a8x__f0x__9fx__90x__9f(void);
+void main__(void);
diff --git a/test.toc b/test.toc
index 4e46515..54f217e 100644
--- a/test.toc
+++ b/test.toc
@@ -1,6 +1,6 @@
-Ĩ @= fn() {
+ųńĨ🐟 @= fn() {
};
main @= fn() {
- Ĩ();
+ ųńĨ🐟();
};