Index: cpp/frams/virtfile/virtfile.cpp
===================================================================
--- cpp/frams/virtfile/virtfile.cpp	(revision 301)
+++ cpp/frams/virtfile/virtfile.cpp	(revision 302)
@@ -12,40 +12,40 @@
 VirtFileSystem *VirtFILE::vfs = NULL;
 
-//#define DEBUG_DLL_CALLS
-
-VirtFILE *Vfopen(const char* path,const char* mode)
-{
-#ifdef DEBUG_DLL_CALLS
-printf("VirtFILE::Vfopen %s %s (vfs=%p)\n",path,mode,VirtFILE::vfs);
-#endif
-return VirtFILE::vfs ? VirtFILE::vfs->Vfopen(path,mode) : NULL;
+//#define DEBUG_VIRTFILE
+
+VirtFILE *Vfopen(const char* path, const char* mode)
+{
+#ifdef DEBUG_VIRTFILE
+	printf("VirtFILE::Vfopen %s %s (vfs=%p)\n",path,mode,VirtFILE::vfs);
+#endif
+	return VirtFILE::vfs ? VirtFILE::vfs->Vfopen(path, mode) : NULL;
 }
 
 VirtDIR *Vopendir(const char* path)
 {
-#ifdef DEBUG_DLL_CALLS
-printf("VirtFILE::Vfopendir %s (vfs=%p)\n",path,VirtFILE::vfs);
-#endif
-return VirtFILE::vfs ? VirtFILE::vfs->Vopendir(path) : NULL;
+#ifdef DEBUG_VIRTFILE
+	printf("VirtFILE::Vfopendir %s (vfs=%p)\n",path,VirtFILE::vfs);
+#endif
+	return VirtFILE::vfs ? VirtFILE::vfs->Vopendir(path) : NULL;
 }
 
 bool Vfexists(const char* path)
 {
-return VirtFILE::vfs ? VirtFILE::vfs->Vfexists(path) : false;
-}
-
-bool Vdirexists(const char* path,bool is_writable)
-{
-return VirtFILE::vfs ? VirtFILE::vfs->Vdirexists(path,is_writable) : false;
+	return VirtFILE::vfs ? VirtFILE::vfs->Vfexists(path) : false;
+}
+
+bool Vdirexists(const char* path, bool is_writable)
+{
+	return VirtFILE::vfs ? VirtFILE::vfs->Vdirexists(path, is_writable) : false;
 }
 
 bool Vmkdir(const char* path)
 {
-return VirtFILE::vfs ? VirtFILE::vfs->Vmkdir(path) : false;
+	return VirtFILE::vfs ? VirtFILE::vfs->Vmkdir(path) : false;
 }
 
 bool Vmkdirs(const char* path)
 {
-return VirtFILE::vfs ? VirtFILE::vfs->Vmkdirs(path) : false;
+	return VirtFILE::vfs ? VirtFILE::vfs->Vmkdirs(path) : false;
 }
 
@@ -55,7 +55,7 @@
 void VirtFILE::selectFileSystem(VirtFileSystem *s)
 {
-vfs=s;
-#ifdef DEBUG_DLL_CALLS
-::printf("VirtFILE::selectFileSystem: %p := %p\n",vfs,s);
+	vfs = s;
+#ifdef DEBUG_VIRTFILE
+	::printf("VirtFILE::selectFileSystem: %p := %p\n",vfs,s);
 #endif
 }
@@ -63,40 +63,40 @@
 int VirtFILE::Vprintf(const char *format, va_list args)
 {
-string s=ssprintf_va(format,args);
-return Vwrite(s.c_str(),1,s.size());
+	string s = ssprintf_va(format, args);
+	return Vwrite(s.c_str(), 1, s.size());
 }
 
 int VirtFILE::printf(const char *format, ...)
 {
-int ret; va_list argptr;
-va_start(argptr,format);
-ret=Vprintf(format,argptr);
-va_end(argptr);
-return ret;
+	int ret; va_list argptr;
+	va_start(argptr, format);
+	ret = Vprintf(format, argptr);
+	va_end(argptr);
+	return ret;
 }
 
 int VirtFILE::getSize()
 {
-  int saved_pos = Vtell();
-  Vseek(0, SEEK_END);
-  int size = Vtell();
-  Vseek(saved_pos, SEEK_SET);
-  return size;
-}
-
-void VirtFILE::setVstdin(VirtFILE *f) {Vstdin=f;}
-void VirtFILE::setVstdout(VirtFILE *f) {Vstdout=f;}
-void VirtFILE::setVstderr(VirtFILE *f) {Vstderr=f;}
-VirtFILE* VirtFILE::getVstdin() {return Vstdin;}
-VirtFILE* VirtFILE::getVstdout() {return Vstdout;}
-VirtFILE* VirtFILE::getVstderr() {return Vstderr;}
+	int saved_pos = Vtell();
+	Vseek(0, SEEK_END);
+	int size = Vtell();
+	Vseek(saved_pos, SEEK_SET);
+	return size;
+}
+
+void VirtFILE::setVstdin(VirtFILE *f) { Vstdin = f; }
+void VirtFILE::setVstdout(VirtFILE *f) { Vstdout = f; }
+void VirtFILE::setVstderr(VirtFILE *f) { Vstderr = f; }
+VirtFILE* VirtFILE::getVstdin() { return Vstdin; }
+VirtFILE* VirtFILE::getVstdout() { return Vstdout; }
+VirtFILE* VirtFILE::getVstderr() { return Vstderr; }
 //////////////////////////////////////////////////////////////////////////
 
 // base class only returns NULL/false/not supported - implementations perform the actual work
-VirtFILE* VirtFileSystem::Vfopen(const char* path,const char* mode) {return NULL;}
-bool VirtFileSystem::Vfexists(const char* path) {return false;}
-VirtDIR* VirtFileSystem::Vopendir(const char* path) {return NULL;}
-bool VirtFileSystem::Vmkdir(const char* path) {return false;}
-bool VirtFileSystem::Vdirexists(const char* path,bool is_writable) {return false;}
+VirtFILE* VirtFileSystem::Vfopen(const char* path, const char* mode) { return NULL; }
+bool VirtFileSystem::Vfexists(const char* path) { return false; }
+VirtDIR* VirtFileSystem::Vopendir(const char* path) { return NULL; }
+bool VirtFileSystem::Vmkdir(const char* path) { return false; }
+bool VirtFileSystem::Vdirexists(const char* path, bool is_writable) { return false; }
 
 //////////////////////////////////////////////////////////////////////////
@@ -104,48 +104,48 @@
 
 
-int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f) {return f->Vread(ptr,size,nmemb);}
-int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f) {return f->Vwrite(ptr,size,nmemb);}
+int fread(void *ptr, size_t size, size_t nmemb, VirtFILE* f) { return f->Vread(ptr, size, nmemb); }
+int fwrite(const void *ptr, size_t size, size_t nmemb, VirtFILE* f) { return f->Vwrite(ptr, size, nmemb); }
 
 
 //since we want our own feof(VirtFILE*) function and some systems unfortunately define feof as a macro, we need to #undef it. Same as in virtfile.h
 #if defined _MSC_VER || defined __CYGWIN__ || defined SHP || defined __ANDROID__
- #pragma push_macro("feof")
- #undef feof
+#pragma push_macro("feof")
+#undef feof
 #endif
 #if defined __BORLANDC__ //does not support #pragma push_macro/pop_macro 
- #undef feof
-#endif
-
-int feof(VirtFILE* f) {return f->Veof();}
+#undef feof
+#endif
+
+int feof(VirtFILE* f) { return f->Veof(); }
 
 //...and then restore the original macro:
 #if defined _MSC_VER || defined __CYGWIN__ || defined SHP || defined __ANDROID__
- #pragma pop_macro("feof")
+#pragma pop_macro("feof")
 #endif
 #if defined __BORLANDC__
- #define feof(__f)     ((__f)->flags & _F_EOF)
-#endif
-
-
-int fputc(int c,VirtFILE* f) {return f->Vputc(c);}
-int fputs(const char *s,VirtFILE* f) {return f->Vputs(s);}
-int fgetc(VirtFILE* f) {return f->Vgetc();}
-int fseek(VirtFILE* f,long offset, int whence) {return f->Vseek(offset,whence);}
-int ftell(VirtFILE* f) {return f->Vtell();}
-void rewind(VirtFILE* f) {f->Vrewind();}
-int fflush(VirtFILE* f) {return f->Vflush();}
-char *fgets(char *s, int size, VirtFILE* f) {return f->Vgets(s,size);}
-int fprintf(VirtFILE* f,const char *format, ...)
-	{
+#define feof(__f)     ((__f)->flags & _F_EOF)
+#endif
+
+
+int fputc(int c, VirtFILE* f) { return f->Vputc(c); }
+int fputs(const char *s, VirtFILE* f) { return f->Vputs(s); }
+int fgetc(VirtFILE* f) { return f->Vgetc(); }
+int fseek(VirtFILE* f, long offset, int whence) { return f->Vseek(offset, whence); }
+int ftell(VirtFILE* f) { return f->Vtell(); }
+void rewind(VirtFILE* f) { f->Vrewind(); }
+int fflush(VirtFILE* f) { return f->Vflush(); }
+char *fgets(char *s, int size, VirtFILE* f) { return f->Vgets(s, size); }
+int fprintf(VirtFILE* f, const char *format, ...)
+{
 	int ret; va_list argptr;
-	va_start(argptr,format);
-	ret=f->Vprintf(format,argptr);
+	va_start(argptr, format);
+	ret = f->Vprintf(format, argptr);
 	va_end(argptr);
 	return ret;
-	}
-int fclose(VirtFILE* f) {delete f; return 0;}
-
-int closedir(VirtDIR* d) {delete d; return 0;}
-dirent* readdir(VirtDIR* d) {return d->Vreaddir();}
+}
+int fclose(VirtFILE* f) { delete f; return 0; }
+
+int closedir(VirtDIR* d) { delete d; return 0; }
+dirent* readdir(VirtDIR* d) { return d->Vreaddir(); }
 
 /////////
@@ -153,8 +153,8 @@
 bool VirtFileSystem::Vmkdirs(const char* path)
 {
-if (Vdirexists(path,true)) return true;
-string parentdir = getFileDir(path);
-if (!Vmkdirs(parentdir.c_str())) return false;
-return Vmkdir(path);
+	if (Vdirexists(path, true)) return true;
+	string parentdir = getFileDir(path);
+	if (!Vmkdirs(parentdir.c_str())) return false;
+	return Vmkdir(path);
 }
 
@@ -164,7 +164,7 @@
 ChainFileSystem::ChainFileSystem(VirtFileSystem *_chain)
 {
-	chain=_chain;
-#ifdef DEBUG_DLL_CALLS
-printf("ChainFileSystem constructor: %p := %p\n",chain,_chain);
+	chain = _chain;
+#ifdef DEBUG_VIRTFILE
+	printf("ChainFileSystem constructor: %p := %p\n",chain,_chain);
 #endif
 }
@@ -173,6 +173,6 @@
 VirtFILE *ChainFileSystem::Vfopen(const char* path, const char* mode)
 {
-#ifdef DEBUG_DLL_CALLS
-printf("ChainFileSystem::Vfopen %s %s (chain=%p)\n",path,mode,chain);
+#ifdef DEBUG_VIRTFILE
+	printf("ChainFileSystem::Vfopen %s %s (chain=%p)\n",path,mode,chain);
 #endif
 	return (chain != NULL) ? chain->Vfopen(path, mode) : NULL;
@@ -186,6 +186,6 @@
 VirtDIR *ChainFileSystem::Vopendir(const char* path)
 {
-#ifdef DEBUG_DLL_CALLS
-printf("ChainFileSystem::Vfopendir %s (chain=%p)\n",path,chain);
+#ifdef DEBUG_VIRTFILE
+	printf("ChainFileSystem::Vfopendir %s (chain=%p)\n",path,chain);
 #endif
 	return (chain != NULL) ? chain->Vopendir(path) : NULL;
@@ -202,6 +202,6 @@
 }
 
-bool ChainFileSystem::Vdirexists(const char* path,bool is_writable)
-{
-	return (chain != NULL) ? chain->Vdirexists(path,is_writable) : false;
-}
+bool ChainFileSystem::Vdirexists(const char* path, bool is_writable)
+{
+	return (chain != NULL) ? chain->Vdirexists(path, is_writable) : false;
+}
