shithub: scc

Download patch

ref: 4c8cd1d527ce2e8023299b091af90a824b7c1532
parent: 91886b417645874398263b84f186d8bffe40e805
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Aug 8 12:39:58 EDT 2014

Use shorter names for type of storage

These names are shorter but have the same meaning that the longers,
so they are better.

--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -46,12 +46,12 @@
 	ENUMERR
 };
 
-#define FUNCTION   0
-#define VARIABLE   1
+#define FUN        0
+#define VAR        1
 #define AUTO      'A'
-#define REGISTER  'R'
-#define STATIC    'T'
-#define PARAMETER 'P'
+#define REG       'R'
+#define MEM       'T'
+#define PAR       'P'
 #define CONST     '#'
 #define LABEL     'L'
 #define OADD      '+'
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -11,7 +11,7 @@
 emit(char what, void *data)
 {
 	switch (what) {
-	case FUNCTION:
+	case FUN:
 		printf("%s:\n", data);
 		break;
 	default:
@@ -23,7 +23,7 @@
 void
 cgen(Symbol *sym, Node *list[])
 {
-	emit(FUNCTION, sym->u.f.name);
+	emit(FUN, sym->u.f.name);
 }
 
 /*
@@ -49,10 +49,10 @@
 	case AUTO:
 		np->addable = 11;
 		break;
-	case REGISTER:
+	case REG:
 		np->addable = 13;
 		break;
-	case STATIC:
+	case MEM:
 		np->addable = 12;
 		break;
 	case CONST:
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -99,15 +99,15 @@
 		break;
 	case 'R':
 		sym = local(token);
-		op = REGISTER;
+		op = REG;
 		break;
 	case 'T':
 		sym = (funbody) ? local(token) : global(token);
-		op = STATIC;
+		op = MEM;
 		break;
 	case 'G':
 		sym = global(token);
-		op = STATIC;
+		op = MEM;
 		public = 1;
 		break;
 	}
@@ -208,7 +208,7 @@
 	case 'G': case 'R': case 'T':
 		break;
 	}
-	sym->type = VARIABLE;
+	sym->type = VAR;
 	sym->u.v.storage = class;
 	sym->u.v.type = gettype(strtok(NULL, "\t"));
 }
@@ -230,7 +230,7 @@
 	curfun = global(token);
 	if ((token = strtok(NULL, "\t")) == NULL)
 		error(ESYNTAX);
-	curfun->type = FUNCTION;
+	curfun->type = FUN;
 	curfun->u.f.name = xstrdup(token);
 	listp = listexp;
 	newp = nodepool;