shithub: scc

Download patch

ref: 5dd0e7ed4619141a86023783b34c3e981025e003
parent: a8877ebf2f19bf0301f90d9bdff9e23605acfe97
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Sep 16 12:06:09 EDT 2014

Use better names for cgen and xcgen

xcgen was a bad idea (imitation of Thompson style), but it could
be better. This patch uses generate for the extern function and
cgen for the static.

--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -92,5 +92,5 @@
 
 extern void error(unsigned nerror, ...);
 extern void genaddable(Node *list[]);
-extern void cgen(Symbol *sym, Node *list[]);
+extern void generate(Symbol *sym, Node *list[]);
 extern void genstack(Symbol *fun);
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -84,11 +84,10 @@
 }
 
 void
-xcgen(Node *np)
+cgen(Node *np)
 {
 	Node *lp, *rp;
-	/* TODO: define a macro with the default integer type */
-	unsigned imm, off;
+	INT imm;
 
 	if (!np || np->complex == 0)
 		return;
@@ -95,9 +94,9 @@
 	lp = np->left;
 	rp = np->right;
 	if (!lp) {
-		xcgen(rp);
+		cgen(rp);
 	} else if (!rp) {
-		xcgen(lp);
+		cgen(lp);
 	} else {
 		Node *p, *q;
 		if (lp->complex > rp->complex)
@@ -104,8 +103,8 @@
 			p = lp, q = rp;
 		else
 			p = rp, q = lp;
-		xcgen(p);
-		xcgen(q);
+		cgen(p);
+		cgen(q);
 	}
 
 	switch (np->op) {
@@ -115,7 +114,7 @@
 }
 
 void
-cgen(Symbol *sym, Node *list[])
+generate(Symbol *sym, Node *list[])
 {
 	extern char odebug;
 	Node *np;
@@ -131,7 +130,7 @@
 	}
 
 	while (np = *list++)
-		xcgen(np);
+		cgen(np);
 
 	if (frame) {
 		emit(LD, SP, IX);
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -371,7 +371,7 @@
 		error(ESYNTAX);
 	listp = NULL;
 	genaddable(listexp);
-	cgen(curfun, listexp);
+	generate(curfun, listexp);
 	curfun = NULL;
 }