-- GENERATED by C->Haskell Compiler, version 0.13.4 (gtk2hs branch) "Bin IO", 13 Nov 2004 (Haskell)-- Edit the ORIGNAL .chs file instead!{-# LINE 1 "./System/Glib/GList.chs" #-}-- -*-haskell-*--- GIMP Toolkit (GTK)---- Author : Axel Simon---- Created: 19 March 2002---- Copyright (C) 2002 Axel Simon---- 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 2.1 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.---- |-- Maintainer : gtk2hs-users@lists.sourceforge.net-- Stability : provisional-- Portability : portable (depends on GHC)---- Defines functions to extract data from a GList and to produce a GList from-- a list of pointers.---- * The same for GSList.--moduleSystem.Glib.GList(GList,readGList,fromGList,toGList,withGList,GSList,readGSList,fromGSList,fromGSListRev,toGSList,withGSList,)whereimportForeignimportControl.Exception(bracket)importControl.Monad(foldM){-# LINE 49 "./System/Glib/GList.chs" #-}typeGList=Ptr(()){-# LINE 51 "./System/Glib/GList.chs" #-}typeGSList=Ptr(()){-# LINE 52 "./System/Glib/GList.chs" #-}-- methods-- Turn a GList into a list of pointers but don't destroy the list.--readGList::GList->IO[Ptra]readGListglist|glist==nullPtr=return[]|otherwise=dox<-(\ptr->do{peekByteOffptr0::IO(Ptr())})glistglist'<-(\ptr->do{peekByteOffptr4::IO(Ptr())})glistxs<-readGListglist'return(castPtrx:xs)-- Turn a GList into a list of pointers (freeing the GList in the process).--fromGList::GList->IO[Ptra]fromGListglist=doglist'<-g_list_reverseglistextractListglist'[]whereextractListglxs|gl==nullPtr=returnxs|otherwise=dox<-(\ptr->do{peekByteOffptr0::IO(Ptr())})glgl'<-g_list_delete_linkglglextractListgl'(castPtrx:xs)-- Turn a GSList into a list of pointers but don't destroy the list.--readGSList::GSList->IO[Ptra]readGSListgslist|gslist==nullPtr=return[]|otherwise=dox<-(\ptr->do{peekByteOffptr0::IO(Ptr())})gslistgslist'<-(\ptr->do{peekByteOffptr4::IO(Ptr())})gslistxs<-readGSListgslist'return(castPtrx:xs)-- Turn a GSList into a list of pointers (freeing the GSList in the process).--fromGSList::GSList->IO[Ptra]fromGSListgslist|gslist==nullPtr=return[]|otherwise=dox<-(\ptr->do{peekByteOffptr0::IO(Ptr())})gslistgslist'<-g_slist_delete_linkgslistgslistxs<-fromGSListgslist'return(castPtrx:xs)-- Turn a GSList into a list of pointers and reverse it.--fromGSListRev::GSList->IO[Ptra]fromGSListRevgslist=extractListgslist[]whereextractListgslistxs|gslist==nullPtr=returnxs|otherwise=dox<-(\ptr->do{peekByteOffptr0::IO(Ptr())})gslistgslist'<-g_slist_delete_linkgslistgslistextractListgslist'(castPtrx:xs)-- Turn a list of something into a GList.--toGList::[Ptra]->IOGListtoGList=foldMprependnullPtr.reversewhere-- prepend :: GList -> Ptr a -> IO GListprependlx=g_list_prependl(castPtrx)-- Turn a list of something into a GSList.--toGSList::[Ptra]->IOGSListtoGSList=foldMprependnullPtr.reversewhere-- prepend :: GSList -> Ptr a -> IO GListprependlx=g_slist_prependl(castPtrx)-- Temporarily allocate a list of something--withGList::[Ptra]->(GSList->IOb)->IObwithGListxs=bracket(toGListxs)g_list_free{-# LINE 135 "./System/Glib/GList.chs" #-}-- Temporarily allocate a list of something--withGSList::[Ptra]->(GSList->IOb)->IObwithGSListxs=bracket(toGSListxs)g_slist_free{-# LINE 140 "./System/Glib/GList.chs" #-}foreignimportccallunsafe"g_list_reverse"g_list_reverse::((Ptr())->(IO(Ptr())))foreignimportccallunsafe"g_list_delete_link"g_list_delete_link::((Ptr())->((Ptr())->(IO(Ptr()))))foreignimportccallunsafe"g_slist_delete_link"g_slist_delete_link::((Ptr())->((Ptr())->(IO(Ptr()))))foreignimportccallunsafe"g_list_prepend"g_list_prepend::((Ptr())->((Ptr())->(IO(Ptr()))))foreignimportccallunsafe"g_slist_prepend"g_slist_prepend::((Ptr())->((Ptr())->(IO(Ptr()))))foreignimportccallunsafe"g_list_free"g_list_free::((Ptr())->(IO()))foreignimportccallunsafe"g_slist_free"g_slist_free::((Ptr())->(IO()))