More file IO!

Can now create, delete, and write to files.
This commit is contained in:
Bob Nystrom
2016-02-20 09:23:42 -08:00
parent bec5181bdb
commit 8e90e3577b
21 changed files with 463 additions and 52 deletions
+6 -2
View File
@@ -11,12 +11,14 @@
extern void directoryList(WrenVM* vm);
extern void fileAllocate(WrenVM* vm);
extern void fileFinalize(void* data);
extern void fileDelete(WrenVM* vm);
extern void fileOpen(WrenVM* vm);
extern void fileSizePath(WrenVM* vm);
extern void fileClose(WrenVM* vm);
extern void fileDescriptor(WrenVM* vm);
extern void fileReadBytes(WrenVM* vm);
extern void fileSize(WrenVM* vm);
extern void fileWriteBytes(WrenVM* vm);
extern void processAllArguments(WrenVM* vm);
extern void statPath(WrenVM* vm);
extern void stdinReadStart(WrenVM* vm);
@@ -32,7 +34,7 @@ extern void timerStartTimer(WrenVM* vm);
// If you add a new method to the longest class below, make sure to bump this.
// Note that it also includes an extra slot for the sentinel value indicating
// the end of the list.
#define MAX_METHODS_PER_CLASS 10
#define MAX_METHODS_PER_CLASS 11
// The maximum number of foreign classes a single built-in module defines.
//
@@ -98,12 +100,14 @@ static ModuleRegistry modules[] =
CLASS(File)
STATIC_METHOD("<allocate>", fileAllocate)
FINALIZER(fileFinalize)
STATIC_METHOD("open_(_,_)", fileOpen)
STATIC_METHOD("delete_(_,_)", fileDelete)
STATIC_METHOD("open_(_,_,_)", fileOpen)
STATIC_METHOD("sizePath_(_,_)", fileSizePath)
METHOD("close_(_)", fileClose)
METHOD("descriptor", fileDescriptor)
METHOD("readBytes_(_,_,_)", fileReadBytes)
METHOD("size_(_)", fileSize)
METHOD("writeBytes_(_,_,_)", fileWriteBytes)
END_CLASS
CLASS(Stat)
STATIC_METHOD("path_(_,_)", statPath)