1 (* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17 MODULE arrayindirect ;
19 FROM SYSTEM IMPORT ADR, TSIZE, SIZE, WORD, ADDRESS ;
23 CreatePermissions = 666B;
25 MaxBufferLength = 1024*16 ;
26 MaxErrorString = 1024* 8 ;
29 FileUsage = (unused, openedforread, openedforwrite, openedforrandom) ;
30 FileStatus = (successful, outofmemory, toomanyfilesopen, failed, connectionfailure) ;
37 Buffer = POINTER TO buf ;
39 position: CARDINAL ; (* where are we through this buffer *)
40 address : ADDRESS ; (* dynamic buffer address *)
41 filled : CARDINAL ; (* length of the buffer filled *)
42 size : CARDINAL ; (* maximum space in this buffer *)
43 left : CARDINAL ; (* number of bytes left to read *)
44 contents: POINTER TO ARRAY [0..MaxBufferLength] OF CHAR ;
47 FileDescriptors = POINTER TO fds ;
58 FileInfo: ARRAY [0..MaxNoOfFiles] OF FileDescriptors ;
62 GetUnixFileDescriptor - returns the UNIX file descriptor of a file.
65 PROCEDURE GetUnixFileDescriptor (f: File) : INTEGER ;
67 IF (f<MaxNoOfFiles) AND (FileInfo[f]#NIL)
69 RETURN( FileInfo[f]^.unixfd )
73 END GetUnixFileDescriptor ;
76 IF GetUnixFileDescriptor(File(1))=0