+/* This buffer is used to store the original buffer before substituting it by out own buffer. Useful for the foreach tag */
+static xbt_dynar_t surfxml_bufferstack_stack = NULL;
+int surfxml_bufferstack_size = 2048;
+static char *old_buff = NULL;
+static void surf_parse_error(char *msg);
+
+void surfxml_bufferstack_push(int new)
+{
+ if (!new)
+ old_buff = surfxml_bufferstack;
+ else {
+ xbt_dynar_push(surfxml_bufferstack_stack, &surfxml_bufferstack);
+ surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
+ }
+}
+
+void surfxml_bufferstack_pop(int new)
+{
+ if (!new)
+ surfxml_bufferstack = old_buff;
+ else {
+ free(surfxml_bufferstack);
+ xbt_dynar_pop(surfxml_bufferstack_stack, &surfxml_bufferstack);
+ }
+}
+