Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Poll Source Code
 previous   up   next 

Types
pollData
Type to manage sockets and corresponding event checks and findings.

pollData

const type: pollData

Type to manage sockets and corresponding event checks and findings. PollData maintains input (checkedEvents) and output (eventFindings) of the function poll. PollData contains a set of sockets. For every socket the checkedEvents and the eventFindings are maintained. The checkedEvents determine, which events (POLLIN, POLLOUT, or POLLINOUT) should be checked by poll. Poll determines the events found and stores them as eventFindings. PollData provides also an iterator, which can be used to iterate over checkedEvents and eventFindings.


Function Summary
void
clear (inout pollData: pData)
Clears pData.
void
addCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck, in file: aFile)
Add eventsToCheck for aSocket to pData.
void
addCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)
Add eventsToCheck for aFile to pData.
void
removeCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck)
Remove eventsToCheck for aSocket from pData.
void
removeCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)
Remove eventsToCheck for aFile from pData.
integer
getCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)
Return the checkedEvents field from pData for aSocket.
integer
getCheck (inout pollData: pData, in file: aFile)
Return the checkedEvents field from pData for aFile.
void
poll (inout pollData: pData)
Waits for one or more of the checkedEvents from pData.
integer
getFinding (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)
Return the eventFindings field from pData for aSocket.
integer
getFinding (inout pollData: pData, in file: aFile)
Return the eventFindings field from pData for aFile.
void
iterChecks (in pollData: pData, in integer: pollMode)
Reset the pollData iterator to process checkedEvents.
void
iterFindings (in pollData: pData, in integer: pollMode)
Reset the pollData iterator to process eventFindings.
boolean
hasNext (inout pollData: pData)
Determine if the pData iterator can deliver another file.
file
nextFile (inout pollData: pData)
Get the next file from the pData iterator.
void
for (inout file: forVar) range (inout pollData: pData) do (in proc: statements) end for
For-loop to loop over the values of the pData iterator.

Function Detail

clear

const proc: clear (inout pollData: pData)

Clears pData. All sockets and all events are removed from pData and the iterator is reset, such that hasNext returns FALSE.


addCheck

const proc: addCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck, in file: aFile)

Add eventsToCheck for aSocket to pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data to which the event checks are added.
aSocket - Socket for which the events should be checked.
eventsToCheck - Events to be added to the checkedEvents field of pData.
fileObj - File to be returned, when the iterator returns files in pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.
MEMORY_ERROR - An out of memory situation occurred.
FILE_ERROR - A limit of the operating system was reached.

addCheck

const proc: addCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)

Add eventsToCheck for aFile to pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data to which the event checks are added.
aFile - File for which the events should be checked.
eventsToCheck - Events to be added to the checkedEvents field of pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.
MEMORY_ERROR - An out of memory situation occurred.
FILE_ERROR - A limit of the operating system was reached.

removeCheck

const proc: removeCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket, in integer: eventsToCheck)

Remove eventsToCheck for aSocket from pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data from which the event checks are removed.
aSocket - Socket for which the events should not be checked.
eventsToCheck - Events to be removed from the checkedEvents field of pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.

removeCheck

const proc: removeCheck (inout pollData: pData, in file: aFile, in integer: eventsToCheck)

Remove eventsToCheck for aFile from pData. EventsToCheck can have one of the following values:

  • POLLIN check if data can be read from the corresponding socket.
  • POLLOUT check if data can be written to the corresponding socket.
  • POLLINOUT check if data can be read or written (POLLIN or POLLOUT).
Parameters:
pollData - Poll data from which the event checks are removed.
aFile - File for which the events should not be checked.
eventsToCheck - Events to be removed from the checkedEvents field of pData.
Raises:
RANGE_ERROR - Illegal value for eventsToCheck.

getCheck

const func integer: getCheck (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)

Return the checkedEvents field from pData for aSocket. The poll function uses the checkedEvents as input. The following checkedEvents can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the events added and removed for aSocket' with addCheck and removeCheck''.

getCheck

const func integer: getCheck (inout pollData: pData, in file: aFile)

Return the checkedEvents field from pData for aFile. The poll function uses the checkedEvents as input. The following checkedEvents can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the events added and removed for aFile' with addCheck and removeCheck''.

poll

const proc: poll (inout pollData: pData)

Waits for one or more of the checkedEvents from pData. Poll waits until one of the checkedEvents for a corresponding socket occurs. When a checkedEvents occurs the eventFindings field is assigned a value. The following eventFindings values are assigned:

  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Raises:
FILE_ERROR - The system function returns an error.

getFinding

const func integer: getFinding (inout pollData: pData, in PRIMITIVE_SOCKET: aSocket)

Return the eventFindings field from pData for aSocket. The poll function assigns the eventFindings for aSocket to pData. The following eventFindings can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the findings of poll concerning aSocket.

getFinding

const func integer: getFinding (inout pollData: pData, in file: aFile)

Return the eventFindings field from pData for aFile. The poll function assigns the eventFindings for aFile to pData. The following eventFindings can be returned:

  • POLLNOTHING no data can be read or written.
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read and written (POLLIN and POLLOUT).
Returns:
POLLNOTHING, POLLIN, POLLOUT or POLLINOUT, depending on the findings of poll concerning aFile.

iterChecks

const proc: iterChecks (in pollData: pData, in integer: pollMode)

Reset the pollData iterator to process checkedEvents. The following calls of hasNext and nextFile refer to the checkedEvents of the given pollMode. PollMode can have one of the following values:

  • POLLNOTHING don't iterate (hasNext returns FALSE).
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read or written (POLLIN and POLLOUT).
Raises:
RANGE_ERROR - Illegal value for pollMode.

iterFindings

const proc: iterFindings (in pollData: pData, in integer: pollMode)

Reset the pollData iterator to process eventFindings. The following calls of hasNext and nextFile refer to the eventFindings of the given pollMode. PollMode can have one of the following values:

  • POLLNOTHING don't iterate (hasNext returns FALSE).
  • POLLIN data can be read from the corresponding socket.
  • POLLOUT data can be written to the corresponding socket.
  • POLLINOUT data can be read or written (POLLIN and POLLOUT).
Raises:
RANGE_ERROR - Illegal value for pollMode.

hasNext

const func boolean: hasNext (inout pollData: pData)

Determine if the pData iterator can deliver another file.

Returns:
TRUE if nextFile would return another file from the pData iterator, FALSE otherwise.

nextFile

const func file: nextFile (inout pollData: pData)

Get the next file from the pData iterator. Successive calls of nextFile return all files from the pData iterator. The file returned by nextFile is determined with the function addCheck. The files covered by the pData iterator are determined with iterChecks or iterFindings.

Returns:
the next file from the pData iterator, or STD_NULL, when no file from the pData iterator is available.

for

const proc: for (inout file: forVar) range (inout pollData: pData) do (in proc: statements) end for

For-loop to loop over the values of the pData iterator. The for-loop loops over the values determined by the pollMode. With iterCheck or iterFindings the pollMode of the iterator is determinated.



 previous   up   next