Blame extension/rwarray.3am

Packit Service f629e6
.TH RWARRAY 3am "Jan 15 2013" "Free Software Foundation" "GNU Awk Extension Modules"
Packit Service f629e6
.SH NAME
Packit Service f629e6
writea, reada \- write and read gawk arrays to/from files
Packit Service f629e6
.SH SYNOPSIS
Packit Service f629e6
.ft CW
Packit Service f629e6
@load "rwarray"
Packit Service f629e6
.sp
Packit Service f629e6
ret = writea(file, array)
Packit Service f629e6
.br
Packit Service f629e6
ret = reada(file, array)
Packit Service f629e6
.ft R
Packit Service f629e6
.SH DESCRIPTION
Packit Service f629e6
The
Packit Service f629e6
.I rwarray
Packit Service f629e6
extension adds two functions named
Packit Service f629e6
.BR writea() .
Packit Service f629e6
and
Packit Service f629e6
.BR reada() ,
Packit Service f629e6
as follows.
Packit Service f629e6
.TP
Packit Service f629e6
.B writea()
Packit Service f629e6
This function takes a string argument, which is the name of the
Packit Service f629e6
file to which dump the array, and the array itself as the second
Packit Service f629e6
argument.
Packit Service f629e6
.B writea()
Packit Service f629e6
understands multidimensional arrays.
Packit Service f629e6
It returns one on success, or zero upon failure.
Packit Service f629e6
.TP
Packit Service f629e6
.B reada()
Packit Service f629e6
is the inverse of
Packit Service f629e6
.BR writea() ;
Packit Service f629e6
it reads the file named as its first argument, filling in
Packit Service f629e6
the array named as the second argument. It clears the array
Packit Service f629e6
first.
Packit Service f629e6
Here too, the return value is one on success and zero upon failure.
Packit Service f629e6
.SH NOTES
Packit Service f629e6
The array created by
Packit Service f629e6
.B reada()
Packit Service f629e6
is identical to that written by
Packit Service f629e6
.B writea()
Packit Service f629e6
in the sense that the contents are the same. However, due
Packit Service f629e6
to implementation issues, the array traversal order of the recreated
Packit Service f629e6
array will likely be different from that of the original array.
Packit Service f629e6
As array traversal order in AWK is by default undefined, this is
Packit Service f629e6
not (technically) a problem.  If you need to guarantee a particular
Packit Service f629e6
traversal order, use the array sorting features in
Packit Service f629e6
.I gawk
Packit Service f629e6
to do so.
Packit Service f629e6
.PP
Packit Service f629e6
The file contains binary data.  All integral values are written
Packit Service f629e6
in network byte order.
Packit Service f629e6
However, double precision floating-point values are written as
Packit Service f629e6
native binary data.  Thus, arrays containing only string data
Packit Service f629e6
can theoretically be dumped on systems with one byte order and
Packit Service f629e6
restored on systems with a different one, but this has not been tried.
Packit Service f629e6
.\" .SH BUGS
Packit Service f629e6
.SH EXAMPLE
Packit Service f629e6
.ft CW
Packit Service f629e6
.nf
Packit Service f629e6
@load "rwarray"
Packit Service f629e6
\&...
Packit Service f629e6
ret = writea("arraydump.bin", array)
Packit Service f629e6
\&...
Packit Service f629e6
ret = reada("arraydump.bin", array)
Packit Service f629e6
.fi
Packit Service f629e6
.ft R
Packit Service f629e6
.SH "SEE ALSO"
Packit Service f629e6
.IR "GAWK: Effective AWK Programming" ,
Packit Service f629e6
.IR filefuncs (3am),
Packit Service f629e6
.IR fnmatch (3am),
Packit Service f629e6
.IR fork (3am),
Packit Service f629e6
.IR inplace (3am),
Packit Service f629e6
.IR ordchr (3am),
Packit Service f629e6
.IR readdir (3am),
Packit Service f629e6
.IR readfile (3am),
Packit Service f629e6
.IR revoutput (3am),
Packit Service f629e6
.IR time (3am).
Packit Service f629e6
.SH AUTHOR
Packit Service f629e6
Arnold Robbins,
Packit Service f629e6
.BR arnold@skeeve.com .
Packit Service f629e6
.SH COPYING PERMISSIONS
Packit Service f629e6
Copyright \(co 2012, 2013,
Packit Service f629e6
Free Software Foundation, Inc.
Packit Service f629e6
.PP
Packit Service f629e6
Permission is granted to make and distribute verbatim copies of
Packit Service f629e6
this manual page provided the copyright notice and this permission
Packit Service f629e6
notice are preserved on all copies.
Packit Service f629e6
.ig
Packit Service f629e6
Permission is granted to process this file through troff and print the
Packit Service f629e6
results, provided the printed document carries copying permission
Packit Service f629e6
notice identical to this one except for the removal of this paragraph
Packit Service f629e6
(this paragraph not being relevant to the printed manual page).
Packit Service f629e6
..
Packit Service f629e6
.PP
Packit Service f629e6
Permission is granted to copy and distribute modified versions of this
Packit Service f629e6
manual page under the conditions for verbatim copying, provided that
Packit Service f629e6
the entire resulting derived work is distributed under the terms of a
Packit Service f629e6
permission notice identical to this one.
Packit Service f629e6
.PP
Packit Service f629e6
Permission is granted to copy and distribute translations of this
Packit Service f629e6
manual page into another language, under the above conditions for
Packit Service f629e6
modified versions, except that this permission notice may be stated in
Packit Service f629e6
a translation approved by the Foundation.
Packit Service f629e6
.\" vim: set filetype=nroff :