From: Peter g. <pg...@co...> - 2008-06-23 18:11:51
|
Sat Jun 21 13:03:12 EDT 2008 Peter Gavin <pg...@gm...> * gnomevfs: Types: only include S[GU]ID bits in perms if not windows; remove the Perm*All flags the Perm*All flags should really be values, not constructors hunk ./Makefile.am 1713 -libHSgnomevfs_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GNOMEVFS_CFLAGS)) +libHSgnomevfs_a_CPPFLAGS = $(filter -I% -D%,$(GLIB_CFLAGS) $(GNOMEVFS_CFLAGS)) -I. hunk ./Makefile.am 1736 + gnomevfs/System/Gnome/VFS/Constants.hsc \ addfile ./gnomevfs/System/Gnome/VFS/Constants.hsc hunk ./gnomevfs/System/Gnome/VFS/Constants.hsc 1 +-- GIMP Toolkit (GTK) Binding for Haskell: binding to libgnomevfs -*-haskell-*- +-- +-- Author : Peter Gavin +-- Created: 21-Jun-2008 +-- +-- Copyright (c) 2008 Peter Gavin +-- +-- This library is free software: you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation, either version 3 of +-- the License, or (at your option) any later version. +-- [_$_] +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- [_$_] +-- You should have received a copy of the GNU Lesser General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/>. +-- [_$_] +-- GnomeVFS, the C library which this Haskell library depends on, is +-- available under LGPL Version 2. The documentation included with +-- this library is based on the original GnomeVFS documentation, +-- Copyright (c) 2001 Seth Nickell <sni...@st...>. The +-- documentation is covered by the GNU Free Documentation License, +-- version 1.2. + +-- #hide + +-- | Maintainer : gtk...@li... +-- Stability : alpha +-- Portability : portable (depends on GHC) +module System.Gnome.VFS.Constants ( + + FilePermissions (..), + permUserAll, + permGroupAll, + permOtherAll + + ) where + +import System.Glib.Flags + +-- | UNIX-like permissions for a file. +data FilePermissions [_$_] +#ifndef WIN32 + = PermSUID + | PermSGID + | PermSticky +#else + = PermSticky +#endif + | PermUserRead + | PermUserWrite + | PermUserExec + | PermGroupRead + | PermGroupWrite + | PermGroupExec + | PermOtherRead + | PermOtherWrite + | PermOtherExec + | PermAccessReadable + | PermAccessWritable + | PermAccessExecutable + deriving (Eq, Ord, Bounded, Show, Read) +instance Flags FilePermissions +permUserAll, permGroupAll, permOtherAll :: [FilePermissions] +permUserAll = [ PermUserRead, PermUserWrite, PermUserExec ] +permGroupAll = [ PermGroupRead, PermGroupWrite, PermGroupExec ] +permOtherAll = [ PermOtherRead, PermOtherWrite, PermOtherExec ] + +instance Enum FilePermissions where +#ifndef WIN32 + fromEnum PermSUID = #{const GNOME_VFS_PERM_SUID} + fromEnum PermSGID = #{const GNOME_VFS_PERM_SGID} +#endif + fromEnum PermSticky = #{const GNOME_VFS_PERM_STICKY} + fromEnum PermUserRead = #{const GNOME_VFS_PERM_USER_READ} + fromEnum PermUserWrite = #{const GNOME_VFS_PERM_USER_WRITE} + fromEnum PermUserExec = #{const GNOME_VFS_PERM_USER_EXEC} + fromEnum PermGroupRead = #{const GNOME_VFS_PERM_GROUP_READ} + fromEnum PermGroupWrite = #{const GNOME_VFS_PERM_GROUP_WRITE} + fromEnum PermGroupExec = #{const GNOME_VFS_PERM_GROUP_EXEC} + fromEnum PermOtherRead = #{const GNOME_VFS_PERM_OTHER_READ} + fromEnum PermOtherWrite = #{const GNOME_VFS_PERM_OTHER_WRITE} + fromEnum PermOtherExec = #{const GNOME_VFS_PERM_OTHER_EXEC} + fromEnum PermAccessReadable = #{const GNOME_VFS_PERM_ACCESS_READABLE} + fromEnum PermAccessWritable = #{const GNOME_VFS_PERM_ACCESS_WRITABLE} + fromEnum PermAccessExecutable = #{const GNOME_VFS_PERM_ACCESS_EXECUTABLE} + [_$_] +#ifndef WIN32 + toEnum #{const GNOME_VFS_PERM_SUID} = PermSUID + toEnum #{const GNOME_VFS_PERM_SGID} = PermSGID +#endif + toEnum #{const GNOME_VFS_PERM_STICKY} = PermSticky + toEnum #{const GNOME_VFS_PERM_USER_READ} = PermUserRead + toEnum #{const GNOME_VFS_PERM_USER_WRITE} = PermUserWrite + toEnum #{const GNOME_VFS_PERM_USER_EXEC} = PermUserExec + toEnum #{const GNOME_VFS_PERM_GROUP_READ} = PermGroupRead + toEnum #{const GNOME_VFS_PERM_GROUP_WRITE} = PermGroupWrite + toEnum #{const GNOME_VFS_PERM_GROUP_EXEC} = PermGroupExec + toEnum #{const GNOME_VFS_PERM_OTHER_READ} = PermOtherRead + toEnum #{const GNOME_VFS_PERM_OTHER_WRITE} = PermOtherWrite + toEnum #{const GNOME_VFS_PERM_OTHER_EXEC} = PermOtherExec + toEnum #{const GNOME_VFS_PERM_ACCESS_READABLE} = PermAccessReadable + toEnum #{const GNOME_VFS_PERM_ACCESS_WRITABLE} = PermAccessWritable + toEnum #{const GNOME_VFS_PERM_ACCESS_EXECUTABLE} = PermAccessExecutable hunk ./gnomevfs/System/Gnome/VFS/Types.chs.pp 36 + module System.Gnome.VFS.Constants, + [_$_] hunk ./gnomevfs/System/Gnome/VFS/Types.chs.pp 52 - FilePermissions(..), hunk ./gnomevfs/System/Gnome/VFS/Types.chs.pp 138 +import System.Gnome.VFS.Constants hunk ./gnomevfs/System/Gnome/VFS/Types.chs.pp 244 --- | UNIX-like permissions for a file. -{# enum GnomeVFSFilePermissions as FilePermissions { - GNOME_VFS_PERM_SUID as PermSUID, - GNOME_VFS_PERM_SGID as PermSGID, - GNOME_VFS_PERM_STICKY as PermSticky, - GNOME_VFS_PERM_USER_READ as PermUserRead, - GNOME_VFS_PERM_USER_WRITE as PermUserWrite, - GNOME_VFS_PERM_USER_EXEC as PermUserExec, - GNOME_VFS_PERM_USER_ALL as PermUserAll, - GNOME_VFS_PERM_GROUP_READ as PermGroupRead, - GNOME_VFS_PERM_GROUP_WRITE as PermGroupWrite, - GNOME_VFS_PERM_GROUP_EXEC as PermGroupExec, - GNOME_VFS_PERM_GROUP_ALL as PermGroupAll, - GNOME_VFS_PERM_OTHER_READ as PermOtherRead, - GNOME_VFS_PERM_OTHER_WRITE as PermOtherWrite, - GNOME_VFS_PERM_OTHER_EXEC as PermOtherExec, - GNOME_VFS_PERM_OTHER_ALL as PermOtherAll, - GNOME_VFS_PERM_ACCESS_READABLE as PermAccessReadable, - GNOME_VFS_PERM_ACCESS_WRITABLE as PermAccessWritable, - GNOME_VFS_PERM_ACCESS_EXECUTABLE as PermAccessExecutable - } deriving (Eq, Bounded, Show) #} -instance Flags FilePermissions - |