Annotation of 43BSD/contrib/apl/doc/quadf, revision 1.1.1.1

1.1       root        1: .LP
                      2: The following standard quad functions
                      3: are available in \*u \*a:
                      4: .IP "\*(qdcr \'name\'" 24
                      5: The result of ``\*(qdcr'' is a character array
                      6: containing the function whose name is
                      7: passed as an argument.
                      8: .IP "\*(qdfx newfn"
                      9: The contents of the character array
                     10: specified as an argument are fixed as
                     11: an \*a function.
                     12: .IP "\*(qdnc \'arg\'"
                     13: This function can be used to determine what
                     14: type of variable an \*a symbol is.  The
                     15: apl symbol must be specified inside quote
                     16: marks, as shown.  The returned value will be:
                     17: .br
                     18: 0 \(em symbol is undefined
                     19: .br
                     20: 2 \(em symbol is a label or variable
                     21: .br
                     22: 3 \(em symbol is a function name
                     23: .br
                     24: 4 \(em unknown type (should not occur)
                     25: .br
                     26: .IP "\*(qdnl arg"
                     27: The argument should be a scalar or vector
                     28: with components 1, 2, or 3.
                     29: This function returns a two-dimensional
                     30: character array containing the names of
                     31: all items whose types are specified in the
                     32: vector
                     33: (same type definitions as for ``\*(qdnc'' above).
                     34: The ordering of names in the matrix is fortuitous.
                     35: .sp 2
                     36: .LP
                     37: The following non-standard quad functions are
                     38: defined:
                     39: .IP "fd \*(qdap \'string\'" 24
                     40: This quad function is used to append a
                     41: character string onto the end of a \*u
                     42: file.  The first argument specifies the
                     43: file descriptor of the file (which should
                     44: have been opened earlier).  The second
                     45: argument is a character array which is
                     46: to be appended.  A carriage return is
                     47: automatically appended to the end of
                     48: each row of the character array when it
                     49: is appended to the end of the file.
                     50: .IP "\*(qdchdir \'directory\'"
                     51: This quad function can be used to change
                     52: \*a to another directory.  Normally, \*a
                     53: runs in the directory that you were in
                     54: when it was started by the ``apl'' command.
                     55: The argument is a character
                     56: vector specifying the new directory (there
                     57: is NO way to default this).  A 0 is returned
                     58: if the ``chdir'' was successful; a \(mi1 is
                     59: returned if it failed.
                     60: .IP "\*(qdclose fd"
                     61: This function complements ``\*(qdopen''.  The
                     62: argument is the file descriptor of a \*u
                     63: file to be closed.  This function returns
                     64: 0 for success or \(mi1 for failure.
                     65: .IP "mode \*(qdcreat \'file\'"
                     66: This function creates a \*u file.  If the
                     67: file already exists, it is truncated to zero
                     68: length.  The creation mode is specified as
                     69: the first argument
                     70: The filename is specified
                     71: in a character vector as the second argument.
                     72: The file descriptor of the created file (or
                     73: \(mi1 for error) is returned.
                     74: .IP "\*(qddup fd"
                     75: This function executes the ``dup'' system
                     76: call.  It returns an integer number which
                     77: may be used as a file descriptor on later
                     78: I/O calls.
                     79: The new file descriptor
                     80: is a duplicate of the argument ``fd''.
                     81: If the argument file descriptor could not be
                     82: duplicated, \(mi1 is returned.
                     83: .IP "\*(qdexec matrix"
                     84: Takes a two-dimensional character matrix
                     85: and formats it into a \*u ``exec'' system
                     86: call.  The matrix passed as an argument
                     87: must be two-dimensional, the rows must
                     88: be \fIzero\fR terminated.
                     89: .IP "\*(qdexit code"
                     90: This quad function is used to terminate
                     91: the execution of the current process,
                     92: with the completion code ``code''.  It should
                     93: be used to terminate child processes and
                     94: can be used to terminate an \*a session;
                     95: however, it is recommended that the system command
                     96: ``)off'' be used for that purpose.
                     97: .IP "\*(qdfloat charvect"
                     98: This quad function is useful in conjunction
                     99: with ``\*(qdwrite'' and ``\*(qdread''.
                    100: Although any type of
                    101: data may be written to a \*u file with
                    102: ``\*(qdwrite'', when it is read with ``\*(qdread'' it
                    103: will be interpreted as character data.  This
                    104: function will convert a character array into
                    105: numeric form.  The array must be a multiple
                    106: of 4 elements long for apl2 and 8 for apl.
                    107: The converted array is the returned value.
                    108: .IP "\*(qdfork xx"
                    109: ``xx'' is a dummy argument.  A ``fork'' system
                    110: call is performed.
                    111: This quad function
                    112: probably will be followed by a
                    113: ``\*(qdexec'' quad function.
                    114: The process-id
                    115: of the child is returned to the parent;
                    116: a zero is returned to the child.
                    117: .IP "pid \*(qdkill signal"
                    118: This function executes the ``kill'' system
                    119: call.  The first argument specifies what
                    120: process is to be signalled.  The second
                    121: argument specifies what signal is to be
                    122: sent.  A 0 is returned for a successful
                    123: ``kill''; \(mi1 is returned if the specified
                    124: process could not be found or is not
                    125: owned by the current user.
                    126: .IP "mode \*(qdopen \'file\'"
                    127: This function is dyadic.  It opens a \*u
                    128: file for use by an \*a function with calls
                    129: via ``\*(qdread'' and ``\*(qdwrite''.  The first
                    130: argument is the mode for the open (0=read,
                    131: 1=write, 2=read/write).  The second
                    132: argument is a character vector containing
                    133: the file name.  The file descriptor of the
                    134: opened file is returned (\(mi1 for error).
                    135: .IP "\*(qdpipe xx"
                    136: This quad function can be used to set up
                    137: a pipe (used for interprocess communication)
                    138: It returns a 2-element vector containing
                    139: the two ``pipe'' file descriptors.
                    140: .IP "\*(qdrd fd"
                    141: This function reads one line from the
                    142: file descriptor specified.  If the line
                    143: is completely blank, a null string is
                    144: returned.  An end-of-file will also return
                    145: a null string.  Otherwise, the returned
                    146: value is the character string which was
                    147: read.
                    148: .IP "\*(qdrm \'filename\'"
                    149: The specified file will be removed,
                    150: equivalent to )drop filename.  A 0
                    151: is returned for a successful remove;
                    152: \(mi1 is returned if the file could not be
                    153: removed or does not exist.
                    154: .IP "fd \*(qdread nbytes"
                    155: This function reads a specified number
                    156: of bytes from a designated file.  The
                    157: first argument is the file descriptor;
                    158: the second is the number of bytes to be
                    159: read.  The data which is read is returned.
                    160: Note that the returned vector is always
                    161: character data \(em to convert to numeric
                    162: format see the function ``\*(qdfloat''.
                    163: .IP "\*(qdrline fd"
                    164: This quad function is identical to ``\*(qdrd'',
                    165: described above.
                    166: .IP "\*(qdrun \'unix command\'"
                    167: The argument passed to ``\*(qdrun'' is executed
                    168: as a \*u shell command.
                    169: .IP "\*(qdseek (fd,pos,mode)"
                    170: This function executes the ``seek'' system
                    171: call on a \*u file.  The argument to
                    172: ``\*(qdseek'' is a three-element vector containing
                    173: the file descriptor, seek offset, and mode
                    174: A 0 is returned for
                    175: a successful seek; \(mi1 is returned if an
                    176: error is detected.
                    177: .IP "signal \*(qdsig action"
                    178: This quad function allows signal processing
                    179: to be turned on and off under \*a function
                    180: control.  The first argument is the signal
                    181: whose processing is to be changed.  The
                    182: second argument specifies how the signal
                    183: will be processed \(em if zero, the signal will
                    184: cause termination of \*a and a possible
                    185: core dump; if non-zero, the signal will be
                    186: ignored.  Note that the special way in which
                    187: interrupts and other signals are processed
                    188: by \*a is turned off by a call to ``\*(qdsig''
                    189: and cannot be turned back on.  A \(mi1 is
                    190: returned on error, a positive number or zero
                    191: for success.
                    192: .IP "\*(qdwait xx"
                    193: This quad function is used in conjunction
                    194: with ``\*(qdfork'' \(em it returns a 3-element
                    195: vector of information about a child
                    196: process which has terminated.  The first
                    197: element is either the 
                    198: process-id of a completed
                    199: child process or \(mi1 (no children).
                    200: The second is the status of the dead 
                    201: process,
                    202: and the last is the completion code.
                    203: .IP "fd \*(qdwrite data"
                    204: This function writes data to a specified
                    205: file.  The first argument is the file
                    206: descriptor; the second is the data to be
                    207: written.  The number of bytes written is
                    208: returned as the count.  Any type of data
                    209: (character or numeric) may be written in
                    210: this manner.
                    211: .LP

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.