absyntax_utils/absyntax_utils.cc
changeset 350 2c3c4dc34979
parent 338 3037bb7e8a82
child 366 1aeb29ee9381
--- a/absyntax_utils/absyntax_utils.cc	Mon Jul 11 09:47:27 2011 +0100
+++ b/absyntax_utils/absyntax_utils.cc	Fri Jul 29 16:03:28 2011 +0100
@@ -50,6 +50,7 @@
 #include <typeinfo>
 #include <list>
 #include <strings.h>
+#include <stdlib.h>  /* required for atoi() */
 
 #include "../util/symtable.hh"
 #include "../util/dsymtable.hh"
@@ -94,6 +95,15 @@
 }
 
 
+/* extract the value of an integer from an integer_c object !! */
+/* NOTE: it must ignore underscores! */
+int extract_integer(symbol_c *sym) {
+  integer_c *integer = dynamic_cast<integer_c *>(sym);  
+  if (integer == NULL) ERROR;
+  
+  return atoi(integer->value);
+}
+
 
 /***********************************************************************/
 /***********************************************************************/