new function enter_file2
authorMatthias Kramm <kramm@quiss.org>
Tue, 3 Feb 2009 18:49:14 +0000 (19:49 +0100)
committerMatthias Kramm <kramm@quiss.org>
Tue, 3 Feb 2009 18:49:14 +0000 (19:49 +0100)
lib/as3/files.c
lib/as3/files.h

index 8b951d9..cf6145b 100644 (file)
@@ -23,7 +23,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <memory.h>
+#include <errno.h>
 #include "files.h"
+#include "tokenizer.h"
 
 static int verbose = 0;
 static void dbg(const char*format, ...)
@@ -182,6 +184,17 @@ char*enter_file(char*filename, void*state)
     return fullfilename;
 }
 
+FILE*enter_file2(char*filename, void*state)
+{
+    char*fullfilename = enter_file(filename, state);
+    FILE*fi = fopen(fullfilename, "rb");
+    if(!fi) {
+       as3_error("Couldn't find file %s: %s", fullfilename, strerror(errno));
+    }
+    return fi;
+}
+
+
 void* leave_file()
 {
     dbg("leaving file %s", current_filename);
index c140065..70fbb54 100644 (file)
@@ -30,6 +30,7 @@ extern char* current_filename_short;
 void add_include_dir(char*dir);
 
 char* enter_file(char*filename, void*state);
+FILE* enter_file2(char*filename, void*state);
 void* leave_file();
 
 #endif