shithub: scc

Download patch

ref: 0b7c80e6d7c308b94d24d1eaf4ec0efc0938f16c
parent: c2698edb9fdaada886594ef754dad5cb79de737a
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Sep 10 16:57:01 EDT 2014

Move to symbol() the trick with identifiers num

This patch allows us to have the trick only in one
place and not in all the code.

--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -81,7 +81,7 @@
 parameter(char *num)
 {
 	static Symbol *tbl;
-	unsigned i = atoi(num+1);
+	unsigned i = atoi(num);
 	static unsigned nr;
 
 	if (i >= NR_FUNPARAM)
@@ -97,7 +97,7 @@
 local(char *num)
 {
 	static Symbol *tbl;
-	unsigned i = atoi(num+1);
+	unsigned i = atoi(num);
 	static unsigned nr;
 
 	if (i >= NR_INT_IDENT)
@@ -113,7 +113,7 @@
 global(char *num)
 {
 	static Symbol *tbl;
-	unsigned i = atoi(num+1);
+	unsigned i = atoi(num);
 	static unsigned nr;
 
 	if (i >= NR_EXT_IDENT)
@@ -184,7 +184,7 @@
 		[GLOBAL] = global,
 		[PARAMETER] = parameter
 	};
-	return (*tbl[t])(token);
+	return (*tbl[t])(token+1);
 }
 
 static void