[comp.lang.icon] Increasing the number of concurrently open files

talmage@luvthang.aquin.ori-cal.COM (David W. Talmage) (06/11/91)

How many open files can an Icon program have at one time?  How can I
change this?  I'm encountering a limit of about 20 with Amiga Icon
version 8.0, February 14, 1990.  It looks like I can open 17 files of
my own choosing.  The remaining three must be &input, &output, and
&errout. 

The documentation tells me of an icont option -SFnnnn where nnnn is
the number of files.  Is there anything else I must do?  I've tried
-SF50, for example, with no change.

Enclosed, for the curious, is a program that determines how many open
files you can have at one time.

David Talmage
uunet!luvthang!talmage

----- Begin included text -----
# File: OpenFileTest.icn
# Author: David W. Talmage
#
# Usage: iconx OpenFileTest [numfiles]
#
# OpenFileTest attempts to open numfiles files and keep them all open
# at the same time.  If it cannot open one of the files, OpenFileTest
# reports the name and number of the file.
#
# OpenFileTest removes all of the files it creates.
#
# By default, numfiles is 15.
#
record fileRec( theFilePointer, theFileName )

procedure main( argv )
local aFileRec
local fileName
local fRecList
local numFRecs
local openFileCount
local j

  openFileCount := 0
  numFRecs := integer( argv[1] ) | 15
  fRecList := list()

#
# CHANGE THE BASE NAME OF THE TEMPORARY FILE TO ONE FITTING YOUR SYSTEM.
#
  every fileName := (tempname("t:xxOFT." ) \ numFRecs) do {


    aFileRec := fileRec( open( fileName, "w" ), fileName ) | break( 
    	write( "OpenFileTest: Can't open ", fileName,
		", file #", openFileCount + 1 ) ) 

    openFileCount +:= 1
    put( fRecList, aFileRec )

  }

  write( "OpenFileTest: opened ", openFileCount, " concurrently." )

  #
  # Clean up after ourselves.  Close and delete each temporary file.
  #
  every j := 1 to openFileCount do {

    close( fRecList[ j ].theFilePointer ) 
    remove( fRecList[ j ].theFileName )

  }
end


# This is a version of Ronald Florence's (ron@mlfarm.com) tempname
# generator from post.icn of January 8, 1991.  That procedure was
# based on Richard Goerwitz's tempname generator, probably the one
# named get_dos_tempname in gdl.icn version 1.2.
#
# tempname() generates a sequence of unique temporary file names with
# some common base name.
#

procedure tempname(basename)
local temp_name
	
  every temp_name := basename || right(1 to 999,3,"0") do {
    close(open(temp_name)) & next
    suspend \temp_name
  }
end

ralph@CS.ARIZONA.EDU ("Ralph Griswold") (06/14/91)

The number of files you can have open at the same time is determined
by your operating system, not by Icon.  On some operating systems,
you can specify the number.  The method varies with the operating
system. On other systems, it's "hardwired" and there's nothing
you can do about it.

  Ralph Griswold / Dept of Computer Science / Univ of Arizona / Tucson, AZ 85721
  +1 602 621 6609   ralph@cs.arizona.edu  uunet!arizona!ralph