#include <stdio.h>
-#define MERGEFILE_TEMPLATE "sorted_chunk.%i"
-
typedef struct
{
FILE* fp;
- char* filename;
int next;
int more;
}
MERGEFILE;
-char* mergefile_makefilename(int i);
-
-MERGEFILE* mergefile_new(int i);
+MERGEFILE* mergefile_new();
void mergefile_delete(MERGEFILE* mf);
-int mergefile_peek_next(MERGEFILE* mf);
+int mergefile_switch_to_input(MERGEFILE* mf);
+
+int mergefile_push(MERGEFILE* mf, int data);
+
+int mergefile_pop(MERGEFILE* mf);
-int mergefile_pop_next(MERGEFILE* mf);
+int mergefile_peek(MERGEFILE* mf);
int mergefile_has_more(MERGEFILE* mf);