home *** CD-ROM | disk | FTP | other *** search
- Queue Library Documentation
-
- Version 1.0
-
- 9 July 1986
-
-
- SECTION 1 - OVERVIEW
- This document describes the queue libraries QUELIBS.LIB and
- QUELIBL.LIB provided by DR for use interfacing the Lattice, and
- compatible, C compilers to the versatile queue system of Concurrent
- DOS and Networked DOS Plus.
-
-
- 1.1 Models Supported
- QUELIBS.LIB provides for small model support whilst QUELIBL.LIB is
- available for programers using the large model.
-
-
- 1.2 Use & Restrictions
- No charge is made for the library and no royalties are due on
- distribution.
-
-
- 1.3 Warranty
- No warranty is offered or implied. Any problems encountered using the
- library should be reported to your local Digital Research Technical
- Support Centre. Persons reporting problems will be offered updates, if
- available.
-
-
- SECTION 2 - TECHNICAL DETAILS
-
-
- 2.1 Queue Restrictions
- The following restrictions (in addition to those imposed by the
- operating system) are applicable.
-
-
- 2.1.1 No. Queues
- A maximum of 16 queues may be open at any one time.
-
-
- 2.1.2 Queue Message Length
- No single message may exceed 256 bytes in length. Messages larger
- than this should be broken up and sent in smaller portions.
-
-
- 2.1.3 Queue Message No
- The maximum message depth (or no of messages) is 256. Note that using
- a large depth of queue may exhaust queue buffer space in the system.
-
-
- 2.2 Queue Interface
- A header file, QUEBIND.H, is provided for use with the Lattice C
- compiler version 3.00 and later. To use this header file with earlier
- versions of this compiler, or with compatible compilers without the
- argument type checking facility, remove the argument type lists from
- the function declarations.
-
- The following set of functions are provided in the queue library:
-
-
- Make Queue
-
- (int) error = q_make(name,size,depth)
-
- name asciiz terminated name string
- all 8 bits are significant
- names starting with MX have special funtion
- The name is a maximum of 8 characters, names with
- more than 8 characters will be truncated, whilst
- names with less than 8 characters will be space
- padded to 8.
-
- size integer specified size in bytes
-
- depth integer specified depth in bytes
-
- error 0 indicates successful operation
- -1 indicates system error creating queue
-
- The specified queue is created in system data area (SYSDAT). Note
- that It must be opened before data can be read/written to it.
-
- Error codes are returned if there are already sixteen queues open
- (Error 7 - No unused queue descriptors), if there is not enough buffer
- space (Error 8 - No free queue buffer), or there is already a queue
- with that name (Error 10 - Queue already in use).
-
-
- Open Queue
-
- (int) qid = q_open(name)
-
- name asciiz terminated name string
- all 8 bits are significant
- names starting with MX have special funtion
- The name is a maximum of 8 characters, names with
- more than 8 characters will be truncated, whilst
- names with less than 8 characters will be space
- padded to 8.
-
- qid number in range 0-15 used to reference
- the specified queue (i.e. the queue handle).
-
- -1 indicates system error opening queue
-
-
- All queues must be explicitly opened before a read, write, or delete
- operation can be done.
-
- An error will result if the queue has not previously been made (Error
- 9 - Cannot find queue).
-
-
-
- Read Queue (Unconditional)
-
- (int) ret = q_read(qid,str)
-
- qid handle of queue to be read from
-
- str character array to receive one message
-
- ret 0 indicates success
- -1 indicates system error reading from queue
-
- The q_read function will read a message from a system queue that has
- previously been opened. If there are not enough messages to read from
- the queue, the process waits until another process writes into the
- queue before returning.
-
- Errors are returned for a queue not having previously been opened or
- having been deleted (Error 9 - Cannot find queue).
-
-
- Read Queue (conditional)
-
- (int) ret = q_cread(qid,str)
-
- id handle of queue to be read from
-
- str character array to receive one message
-
- ret 0 indicates success
- 1 indicates no message
- -1 indicates system error reading from queue
-
- The q_cread function will read a message from a system queue that has
- previously been opened. If there are no more messages to read from the
- queue, an error code is returned instead of waiting until another
- process writes into the queue.
-
- Errors are returned for a queue not having previously been opened or
- having been deleted (Error 9 - Cannot find queue), or for no more
- messages in the queue (Main error 1, extended error 14 - Empty queue).
-
-
-
- Write Queue (unconditional)
-
-
- (int) ret = q_write(qid,str)
-
- qid handle of queue to be writen to
-
- str character array to send
-
- ret 0 indicates success
- -1 indicates system error writing to the queue
-
- The q_write function will write a message to a system queue that has
- previously been opened. If there is no more message space, the process
- waits until another process reads from the queue before returning.
-
- Errors are returned for a queue not having previously been opened or
- having been deleted (Error 9 - Cannot find queue).
-
-
- Write Queue (conditional)
-
- (int) ret = q_cwrite(qid,str)
-
- qid handle of queue to be written to
-
- str character array to send
-
- ret 0 indicates success
- 1 indicates no queue space
- -1 indicates system error writing to the queue
-
- The q_cwrite function will write a message to a system queue that has
- previously been opened. If there is no more message space, an error
- code is returned immediately instead of waiting until another process
- reads from the queue.
-
- Errors are returned for a queue not having previously been opened or
- having been deleted (Error 9 - Cannot find queue), or for no more
- queue space (Main error code 1, extended error code 15 - Full queue).
-
-
-
- Delete Queue
-
- (int) ret = q_delete(qid)
-
- qid handle of queue to remove
-
- ret 0 indicates success
- -1 indicates system error
-
- This call will delete the queue from the system and reclaim the queue
- buffer space. Any messages in the queue are lost.
-
- The system returns error codes if the queue cannot be deleted (error
- 10 - queue in use) or if the queue has not previously been opened
- (error 9 - Cannot find queue).
-
-
- Queue Error
-
- (int) error = q_error()
-
-
- error system status code following last
- operation.
-
- This provides an extended error value and should only be called
- following a system error being returned on a queue function.
-
- Possible error codes are:
-
- 7 No more queue descriptors: Only sixteen queues may be
- open at any one time.
- 8 No free queue buffer space: Queue buffer space is
- allocated inside sysdat and there is no more available.
- Either reduce the depth or length of queues, or build a
- new system with more buffer space.
- 9 Cannot find queue:
- OPEN operation : The queue has not yet been made.
- READ/WRITE/DELETE : The queue has not been opened.
- 10 Queue in use: The specified mutual exclusion queue is
- currently owned by another process.
- 13 No queue access.
- 14 Empty queue: Returned by q_cread when the queue was
- empty. In this case the main error return is 1.
- 15 Full queue: Returned by q_cwrite when the queue was
- full. In this case the main error return is 1.
- 16 CLI queue missing.
-
-
- 3.0 Library Creation
-
- The library source files are supplied on the disk. The files are:
-
-
- QUEBIND.C QUEBIND.H QUEASM.ASM
-
- C part of Header file MASM assembly
- bindings for quebind.c part of bindings.
-
-
- The source is written to support two memory models, the S or C model
- (LARGE_MODEL = FALSE) or the L model (LARGE_MODEL = TRUE). The C part
- will pick up a compile time definition and requires no code
- modifications, but the assembler part will require the LARGE_MODEL equ
- set appropriately.
-
-
- To compile the bindings:
-
-
-
- L model:
- Set the LARGE_MODEL switch in queasm.asm to TRUE
-
- lc -mls quebind
- masm queasm;
- del quelibl.lib
- lib quelibl+quebind+queasm;
-
-
-
- S model:
- Set the LARGE_MODEL switch in queasm.asm to FALSE
-
- lc -ms quebind
- masm queasm;
- del quelibs.lib
- lib quelibs+quebind+queasm;
-
-
- 4.0 Sample Programs
-
- Three sample programs are included. The first two, QUETST.C and
- QUESLAVE.C are a pair. QUETST will make and open two queues, INQ and
- OUTQ, send 1000 messages to the OUTQ queue, printing a message on the
- screen to indicate the message number being sent. It will also scan
- the INQ queue for messages and print them on the screen when received.
- Note this program should be started first as it makes the queues.
- QUESLAVE will scan OUTQ for messages and return them to QUETST on INQ.
- Both programs will print status information on the screen as they run
- - a '<' will be printed when a 'q_cread' call returns empty queue, and
- a '>' will be printed when a 'q_cwrite' call returns full queue.
- Additionally, QUESLAVE will print a '.' on a successful q_cwrite, i.e.
- one '.' per message.
- QUETST will delete the queues on completion, which should terminate
- QUESLAVE with error code 9.
-
- The third program QUEDEL.C is used to delete the queues INQ and OUTQ
- if you stop the quetst program while it is running.
-
-
- To create the sample program, %1:
-
- lc -ms %1
- link \lc\s\c+%1,%1,%1/m,\lc\s\lc+quelibs
-
- (To use the L memory model, substitute l for s in the above)
-
-