[Mono-list] Wrapper additions
Jim Richardson
develop@wtfo.wtfo-guru.com
Wed, 19 Sep 2001 22:44:08 -0500
Well I am glad you made me think about this a bit more. Further
research indicated an entirely different dirent structure layout
than I had first seen in glib.
Does this look better?
$ cvs diff -u genwrapper.pl wrapper.c
Index: genwrapper.pl
===================================================================
RCS file: /cvs/public/mono/mono/wrapper/genwrapper.pl,v
retrieving revision 1.4
diff -u -r1.4 genwrapper.pl
--- genwrapper.pl 2001/09/10 09:03:07 1.4
+++ genwrapper.pl 2001/09/19 23:39:53
@@ -71,6 +71,21 @@
create_func ($lib, "", "unlink", "int",
"string", "path");
+create_func ($lib, "", "opendir", "IntPtr",
+ "string", "path");
+
+create_func ($lib, "", "readdir", "string",
+ "IntPtr", "dir");
+
+create_func ($lib, "", "closedir", "int",
+ "IntPtr", "dir");
+
+create_func ($lib, "", "getenv", "IntPtr",
+ "string", "variable");
+
+create_func ($lib, "", "environ", "IntPtr");
+
+
map_const ("int", "%d", "SEEK_SET",
"int", "%d", "SEEK_CUR",
"int", "%d", "SEEK_END",
Index: wrapper.c
===================================================================
RCS file: /cvs/public/mono/mono/wrapper/wrapper.c,v
retrieving revision 1.2
diff -u -r1.2 wrapper.c
--- wrapper.c 2001/09/10 07:39:00 1.2
+++ wrapper.c 2001/09/19 23:39:53
@@ -1,5 +1,7 @@
#include <config.h>
#include <limits.h>
+#include <dirent.h>
+#include <stdlib.h>
#include "wrapper.h"
@@ -93,3 +95,33 @@
return unlink(path);
}
+int
+mono_wrapper_opendir (const char * path)
+{
+ return (int)opendir(path);
+}
+
+const char *
+mono_wrapper_readdir (int dir)
+{
+ struct dirent* p = readdir((DIR*)dir);
+ return p != NULL ? p->d_name : NULL;
+}
+
+gint32
+mono_wrapper_closedir (int dir)
+{
+ return closedir((DIR*)dir);
+}
+
+int
+mono_wrapper_getenv (const char * variable)
+{
+ return (int)getenv(variable);
+}
+
+int
+mono_wrapper_environ ()
+{
+ return (int)environ;
+}