+/*
+ * On windows systems where we're not compiling with MING32 we need a
+ * little extra help on dependinces for implementing our own dirent.h
+ * in fs.c.
+ */
+#if defined(_WIN32) && !defined(__MINGW32__)
+# define _WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <io.h>
+# include <fcntl.h>
+
+ struct dirent {
+ long d_ino;
+ unsigned short d_reclen;
+ unsigned short d_namlen;
+ char d_name[FILENAME_MAX];
+ };
+
+ typedef struct {
+ struct _finddata_t dd_dta;
+ struct dirent dd_dir;
+ long dd_handle;
+ int dd_stat;
+ char dd_name[1];
+ } DIR;
+ /*
+ * Visual studio also lacks S_ISDIR for sys/stat.h, so we emulate this as well
+ * which is not hard at all.
+ */
+# ifdef S_ISDIR
+# undef S_ISDIR
+# endif /*! S_ISDIR */
+# define S_ISDIR(X) ((X)&_S_IFDIR)
+#else
+# include <dirent.h>
+#endif /*! _WIN32 && !defined(__MINGW32__) */
+
+/*===================================================================*/
+/*=========================== stat.c ================================*/
+/*===================================================================*/
+void stat_info (void);
+char *stat_mem_strdup (const char *, size_t, const char *, bool);
+void *stat_mem_reallocate(void *, size_t, size_t, const char *);
+void stat_mem_deallocate(void *);
+void *stat_mem_allocate (size_t, size_t, const char *);
+
+#define mem_a(SIZE) stat_mem_allocate ((SIZE), __LINE__, __FILE__)
+#define mem_d(PTRN) stat_mem_deallocate((void*)(PTRN))
+#define mem_r(PTRN, SIZE) stat_mem_reallocate((void*)(PTRN), (SIZE), __LINE__, __FILE__)
+#define mem_af(SIZE, FILE, LINE) stat_mem_allocate ((SIZE), (LINE), (FILE))