diff lwasm/lwasm.c @ 359:f50a54d0293a

Indexed part 1
author lost@starbug
date Wed, 31 Mar 2010 21:57:45 -0600
parents 0cf4948d53b4
children d96c30e60ddf
line wrap: on
line diff
--- a/lwasm/lwasm.c	Wed Mar 31 20:37:59 2010 -0600
+++ b/lwasm/lwasm.c	Wed Mar 31 21:57:45 2010 -0600
@@ -580,3 +580,35 @@
 		(*p) += 2;
 	return rval;
 }
+
+int lwasm_lookupreg3(const char *regs, char **p)
+{
+	int rval = 0;
+	
+	while (*regs)
+	{
+		if (toupper(**p) == *regs)
+		{
+			if (regs[1] == ' ' && !isalpha(*(*p + 1)))
+				break;
+			if (toupper(*(*p + 1)) == regs[1])
+			{
+				if (regs[2] == ' ' && !isalpha(*(*p + 2)))
+					break;
+				if (toupper(*(*p + 2)) == regs[2])
+					break;
+			}
+		}
+		regs += 3;
+		rval++;
+	}
+	if (!*regs)
+		return -1;
+	if (regs[1] == ' ')
+		(*p)++;
+	else if (regs[2] == ' ')
+		(*p) += 2;
+	else
+		(*p) += 3;
+	return rval;
+}