gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, extgawk, updated. 60cc3b626b5c6cdd461269


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 60cc3b626b5c6cdd4612691c1437172a4d6017bd
Date: Mon, 30 Jul 2012 19:31:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  60cc3b626b5c6cdd4612691c1437172a4d6017bd (commit)
      from  dc8d2e7b62b9191266a281c80ebb1265436250fc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=60cc3b626b5c6cdd4612691c1437172a4d6017bd

commit 60cc3b626b5c6cdd4612691c1437172a4d6017bd
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Jul 30 22:31:17 2012 +0300

    Doc updates for extensions.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 75f0d79..76b96f6 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -3,6 +3,9 @@
        * ABOUT-NLS: New file.
        * Makefile.am, configure.ac: Revised for gettext.
 
+       * fork.3am, readdir.3am, time.3am: New files.
+       * filefuncs.3am, fnmatch.3am, ordchr.3am, readfile.3am: Revised.
+
 2012-07-29         Andrew J. Schorr     <address@hidden>
 
        * readdir.c (dir_get_record): Adjust to new interface for RT.
diff --git a/extension/filefuncs.3am b/extension/filefuncs.3am
index 3e606bc..bdb8fe5 100644
--- a/extension/filefuncs.3am
+++ b/extension/filefuncs.3am
@@ -305,12 +305,15 @@ heirarchy and its information.
 .SH EXAMPLE
 .ft CW
 .nf
+FIXME: NEED AN EXAMPLE
 .fi
 .ft R
 .SH "SEE ALSO"
 .IR "GAWK: Effective AWK Programming" ,
 .IR fnmatch (3am),
+.IR fork (3am),
 .IR ordchr (3am),
+.IR readdir (3am),
 .IR readfile (3am),
 .IR rwarray (3am),
 .IR time (3am).
diff --git a/extension/fnmatch.3am b/extension/fnmatch.3am
index eefa5dc..2a922d2 100644
--- a/extension/fnmatch.3am
+++ b/extension/fnmatch.3am
@@ -84,7 +84,9 @@ if (fnmatch("*.a", "foo.c", flags) == FNM_NOMATCH)
 .IR fnmatch (3),
 .IR "GAWK: Effective AWK Programming" ,
 .IR filefuncs (3am),
+.IR fork (3am),
 .IR ordchr (3am),
+.IR readdir (3am),
 .IR readfile (3am),
 .IR rwarray (3am),
 .IR time (3am).
diff --git a/extension/ordchr.3am b/extension/fork.3am
similarity index 55%
copy from extension/ordchr.3am
copy to extension/fork.3am
index f2aec9c..4fb9681 100644
--- a/extension/ordchr.3am
+++ b/extension/fork.3am
@@ -1,48 +1,64 @@
-.TH ORDCHR 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.TH FORK 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
 .SH NAME
-ordchr \- convert characters to strings and vice versa
+fork, wait, waitpid \- basic process management
 .SH SYNOPSIS
 .ft CW
address@hidden "ordchr"
address@hidden "fork"
 .br
-number = ord("A")
-.br
-string = chr(65)
+pid = fork()
+.sp
+ret = waitpid(pid)
+.sp
+ret = wait();
 .ft R
 .SH DESCRIPTION
 The
-.I ordchr
-extension adds two functions named
-.BR ord() .
-and
-.BR chr() ,
-as follows.
+.I fork
+extension adds three functions, as follows.
 .TP
-.B ord()
-This function takes a string argument, and returns the
-numeric value of the first character in the string.
+.B fork()
+This function creates a new process. The return value is the zero
+in the child and the process-id number of the child in the parent,
+or \-1 upon error. In the latter case,
+.B ERRNO
+indicates the problem.
+In the child, \fBPROCINFO["pid"]\fP and \fBPROCINFO["ppid"]\fP
+are updated to reflect the correct values.
 .TP
-.B chr()
-This function takes a numeric argument and returns a string
-whose first character is that represented by the number.
-.PP
-These functions are inspired by the Pascal language functions
-of the same name.
+.B waitpid()
+This function takes a numeric argument, which is the process-id to
+wait for. The return value is that of the
+.IR waitpid (2)
+system call.
+.TP
+.B wait()
+This function waits for the first child to die.
+The return value is that of the
+.IR wait (2)
+system call.
 ... .SH NOTES
-... .SH BUGS
+.SH BUGS
+There is no corresponding
+.B exec()
+function.
+.PP
+The interfaces could be enhanced to provide more facilities.
 .SH EXAMPLE
 .ft CW
 .nf
address@hidden "ordchr"
address@hidden "fork"
 \&...
-printf("The numeric value of 'A' is %d\en", ord("A"))
-printf("The string value of 65 is %s\en", chr(65))
+if ((pid = fork()) == 0)
+    print "hello from the child"
+else
+    print "hello from the parent"
 .fi
 .ft R
 .SH "SEE ALSO"
 .IR "GAWK: Effective AWK Programming" ,
 .IR filefuncs (3am),
 .IR fnmatch (3am),
+.IR readdir (3am),
 .IR readfile (3am),
 .IR rwarray (3am),
 .IR time (3am).
diff --git a/extension/ordchr.3am b/extension/ordchr.3am
index f2aec9c..a7d7b90 100644
--- a/extension/ordchr.3am
+++ b/extension/ordchr.3am
@@ -43,6 +43,8 @@ printf("The string value of 65 is %s\en", chr(65))
 .IR "GAWK: Effective AWK Programming" ,
 .IR filefuncs (3am),
 .IR fnmatch (3am),
+.IR fork (3am),
+.IR readdir (3am),
 .IR readfile (3am),
 .IR rwarray (3am),
 .IR time (3am).
diff --git a/extension/ordchr.3am b/extension/readdir.3am
similarity index 54%
copy from extension/ordchr.3am
copy to extension/readdir.3am
index f2aec9c..57c61f3 100644
--- a/extension/ordchr.3am
+++ b/extension/readdir.3am
@@ -1,48 +1,59 @@
-.TH ORDCHR 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.TH READDIR 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
 .SH NAME
-ordchr \- convert characters to strings and vice versa
+readdir \- directory input parser for gawk
 .SH SYNOPSIS
 .ft CW
address@hidden "ordchr"
address@hidden "readdir"
 .br
-number = ord("A")
-.br
-string = chr(65)
+readdir_do_ftype(1)    # or 0
 .ft R
 .SH DESCRIPTION
 The
-.I ordchr
-extension adds two functions named
-.BR ord() .
-and
-.BR chr() ,
-as follows.
-.TP
-.B ord()
-This function takes a string argument, and returns the
-numeric value of the first character in the string.
-.TP
-.B chr()
-This function takes a numeric argument and returns a string
-whose first character is that represented by the number.
+.I readdir
+extension
+adds an input parser for directories, and
+adds a single function named
+.BR readdir_do_ftype() .
+.PP
+When this extension is in use, instead of skipping directories named
+on the command line (or with
+.BR getline ),
+they are read, with each entry returned as a record.
+.PP
+The record consists of at least two fields: the inode number and the
+filename, separated by a forward slash character.
+On systems where the directory entry contains the file type, the record
+has a third field which is a single letter indicating the type of the
+file:
+.B f
+for file,
+.B d
+for directory, and so on.
 .PP
-These functions are inspired by the Pascal language functions
-of the same name.
+On systems without the file type information, calling
+.B readdir_do_ftype(1)
+causes the extension to use
+.IR stat (2)
+to retrieve the appropriate information. This is not the default, since
+.IR stat (2)
+is a potentially expensive operation.
 ... .SH NOTES
 ... .SH BUGS
 .SH EXAMPLE
 .ft CW
 .nf
address@hidden "ordchr"
address@hidden "readdir"
 \&...
-printf("The numeric value of 'A' is %d\en", ord("A"))
-printf("The string value of 65 is %s\en", chr(65))
+BEGIN { FS = "/" }
+{ print "file name is", $2 }
 .fi
 .ft R
 .SH "SEE ALSO"
 .IR "GAWK: Effective AWK Programming" ,
 .IR filefuncs (3am),
 .IR fnmatch (3am),
+.IR fork (3am),
+.IR ordchr (3am),
 .IR readfile (3am),
 .IR rwarray (3am),
 .IR time (3am).
diff --git a/extension/readfile.3am b/extension/readfile.3am
index 76a38ca..1bcb94f 100644
--- a/extension/readfile.3am
+++ b/extension/readfile.3am
@@ -27,8 +27,8 @@ Upon error, the function returns the empty string and sets
 \&...
 contents = readfile("/path/to/file");
 if (contents == "" && ERRNO != "") {
-       print("problem reading file", ERRNO) > "/dev/stderr"
-       ...
+    print("problem reading file", ERRNO) > "/dev/stderr"
+    ...
 }
 .fi
 .ft R
@@ -36,7 +36,9 @@ if (contents == "" && ERRNO != "") {
 .IR "GAWK: Effective AWK Programming" ,
 .IR filefuncs (3am),
 .IR fnmatch (3am),
+.IR fork (3am),
 .IR ordchr (3am),
+.IR readdir (3am),
 .IR rwarray (3am),
 .IR time (3am).
 .SH AUTHOR
diff --git a/extension/ordchr.3am b/extension/time.3am
similarity index 59%
copy from extension/ordchr.3am
copy to extension/time.3am
index f2aec9c..ad582b7 100644
--- a/extension/ordchr.3am
+++ b/extension/time.3am
@@ -1,51 +1,60 @@
-.TH ORDCHR 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.TH TIME 3am "Jul 30 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
 .SH NAME
-ordchr \- convert characters to strings and vice versa
+time \- time functions for gawk
 .SH SYNOPSIS
 .ft CW
address@hidden "ordchr"
address@hidden "time"
 .br
-number = ord("A")
-.br
-string = chr(65)
+time = gettimeofday()
+.sp
+ret = sleep(amount)
 .ft R
 .SH DESCRIPTION
 The
-.I ordchr
+.I time
 extension adds two functions named
-.BR ord() .
+.BR gettimeofday() .
 and
-.BR chr() ,
+.BR sleep() ,
 as follows.
 .TP
-.B ord()
-This function takes a string argument, and returns the
-numeric value of the first character in the string.
+.B gettimeofday()
+This function returns the number of seconds since the Epoch
+as a floating-point value. It should have subsecond precision.
+It returns \-1 upon error and sets
+.B ERRNO
+to indicate the problem.
 .TP
-.B chr()
-This function takes a numeric argument and returns a string
-whose first character is that represented by the number.
-.PP
-These functions are inspired by the Pascal language functions
-of the same name.
+.BI sleep( seconds )
+This function attempts to sleep for the given amount of seconds, which
+may include a fractional portion.
+If
+.I seconds
+is negative, or the attempt to sleep fails,
+then it returns \-1 and sets
+.BR ERRNO .
+Otherwise, the function should return 0 after sleeping
+for the indicated amount of time.
 ... .SH NOTES
 ... .SH BUGS
 .SH EXAMPLE
 .ft CW
 .nf
address@hidden "ordchr"
address@hidden "time"
 \&...
-printf("The numeric value of 'A' is %d\en", ord("A"))
-printf("The string value of 65 is %s\en", chr(65))
+printf "It is now %g seconds since the Epoch\en", gettimeofday()
+printf "Pausing for a while... " ; sleep(2.5) ; print "done"
 .fi
 .ft R
 .SH "SEE ALSO"
 .IR "GAWK: Effective AWK Programming" ,
 .IR filefuncs (3am),
 .IR fnmatch (3am),
+.IR fork (3am),
+.IR ordchr (3am),
+.IR readdir (3am),
 .IR readfile (3am),
 .IR rwarray (3am),
-.IR time (3am).
 .SH AUTHOR
 Arnold Robbins,
 .BR address@hidden .

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog                   |    3 +
 extension/filefuncs.3am               |    3 +
 extension/fnmatch.3am                 |    2 +
 extension/{ordchr.3am => fork.3am}    |   66 ++++++++++++++++++++------------
 extension/ordchr.3am                  |    2 +
 extension/{ordchr.3am => readdir.3am} |   61 ++++++++++++++++++------------
 extension/readfile.3am                |    6 ++-
 extension/{ordchr.3am => time.3am}    |   53 +++++++++++++++-----------
 8 files changed, 122 insertions(+), 74 deletions(-)
 copy extension/{ordchr.3am => fork.3am} (55%)
 copy extension/{ordchr.3am => readdir.3am} (54%)
 copy extension/{ordchr.3am => time.3am} (59%)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]