+2002-07-08 Vince Darley <vincentdarley@sourceforge.net>
+ * generic/vfs.c: update for latest cvs head.
+ * win/makefile.vc: compilation into Release and Debug
+ directories as appropriate.
+
2002-06-22 Jean-Claude Wippler <jcw@equi4.com>
* mac/pkgIndex_mac.tcl:
* library/pkgIndex.tcl:
including a small library of Tcl code). The goal of this extension
is to expose Tcl 8.4's new filesystem C API to the Tcl level.
-Since 8.4 is still in alpha, the APIs on which this extension depends may of
-course change. If that happens, it will of course require changes to this
-extension, until the point at which 8.4 goes final, when only
-backwards-compatible changes should occur. Currently it requires a
-version of Tcl 8.4a5 or newer (from March 30th 2002) --- if it compiles
-without warning, you should be fine.
-
Using this extension, the editor Alphatk can actually auto-mount, view and
edit (but not save, since they're read-only) the contents of .zip files
directly (see <http://www.santafe.edu/~vince/Alphatk.html>), and you can
}
}
+static Tcl_Obj*
+VfsGetMode(int mode) {
+ Tcl_Obj *ret = Tcl_NewObj();
+ if (mode & O_RDONLY) {
+ Tcl_AppendToObj(ret, "r", 1);
+ } else if (mode & O_WRONLY || mode & O_RDWR) {
+ if (mode & O_TRUNC) {
+ Tcl_AppendToObj(ret, "w", 1);
+ } else {
+ Tcl_AppendToObj(ret, "a", 1);
+ }
+ if (mode & O_RDWR) {
+ Tcl_AppendToObj(ret, "+", 1);
+ }
+ }
+ return ret;
+}
+
static Tcl_Channel
-VfsOpenFileChannel(cmdInterp, pathPtr, modeString, permissions)
+VfsOpenFileChannel(cmdInterp, pathPtr, mode, permissions)
Tcl_Interp *cmdInterp; /* Interpreter for error reporting;
* can be NULL. */
Tcl_Obj *pathPtr; /* Name of file to open. */
- CONST char *modeString; /* A list of POSIX open modes or
- * a string such as "rw". */
+ int mode; /* POSIX open mode. */
int permissions; /* If the open involves creating a
* file, with what modes to create
* it? */
return NULL;
}
- Tcl_ListObjAppendElement(interp, mountCmd, Tcl_NewStringObj(modeString,-1));
+ Tcl_ListObjAppendElement(interp, mountCmd, VfsGetMode(mode));
Tcl_ListObjAppendElement(interp, mountCmd, Tcl_NewIntObj(permissions));
Tcl_SaveResult(interp, &savedResult);
/* Now we execute this mount point's callback. */
}
proc vfs::modeToString {mode} {
+ # Turn a POSIX open 'mode' set of flags into a more readable
+ # string 'r', 'w', 'w+', 'a', etc.
+ set res ""
+ if {$mode & 1} {
+ append res "r"
+ } elseif {$mode & 2} {
+ if {$mode & 16} {
+ append res "w"
+ } else {
+ append res "a"
+ }
+ }
+ if {$mode & 4} {
+ append res "+"
+ }
+ set res
}
# These lists are used to convert attribute indices into the string equivalent.
DLL_VERSION = 10
# comment the following line to compile with symbols
-NODEBUG=0
+NODEBUG=1
!IF "$(NODEBUG)" == "1"
DEBUGDEFINES =
# note that the tcl vclibs should have been unpacked in $(TCL)\lib !!
ROOT = ..
-WINDIR = $(ROOT)\win
+!IF "$(NODEBUG)" == "1"
+WINDIR = $(ROOT)\win\Release
+!ELSE
+WINDIR = $(ROOT)\win\Debug
+!ENDIF
GENERICDIR = $(ROOT)\generic
LIBDIR = $(ROOT)\library
TOOLS32 = C:\Progra~1\devstudio\vc
cc32 = $(TOOLS32)\bin\cl -I$(TOOLS32)\include
CP = copy
RM = del
+!if "$(OS)" == "Windows_NT"
+RMDIR = rmdir /S /Q
+!else
+RMDIR = deltree /Y
+!endif
INCLUDES = \
-I../../tcl8.4/generic \
# Targets
-all: $(PROJECT).dll
+all: setup $(PROJECT).dll
+
+setup:
+ -@md $(WINDIR)
install: $(PROJECT).dll
-@md $(INSTALLDIR)
clean:
-$(RM) $(WINDIR)\*.obj
+ -$(RMDIR) $(WINDIR)
-$(RM) $(PROJECT).dll
-$(RM) $(PROJECT).lib
-$(RM) $(PROJECT).exp