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. 43a12b8c65b687489e0dbb


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 43a12b8c65b687489e0dbb29cd707eeff92e5865
Date: Fri, 20 Jul 2012 09:09:58 +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  43a12b8c65b687489e0dbb29cd707eeff92e5865 (commit)
       via  91049b1eef7366b3223e36125d6cfca898f8c3dd (commit)
       via  50831fa7f402480d83d5e3647d09acdad7cd0eeb (commit)
      from  ffbf8454171c0ef037db425f436c735da3691d9f (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=43a12b8c65b687489e0dbb29cd707eeff92e5865

commit 43a12b8c65b687489e0dbb29cd707eeff92e5865
Merge: 91049b1 ffbf845
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Jul 20 12:09:24 2012 +0300

    Merge branch 'extgawk' of ssh://git.sv.gnu.org/srv/git/gawk into extgawk

diff --cc ChangeLog
index 6aeaf89,60e560a..c2ed6fe
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,9 -1,21 +1,27 @@@
 +2012-07-20         Arnold D. Robbins     <address@hidden>
 +
 +      * gawkapi.h: Rework table to not take up so much space.
 +      * gawkapi.c (api_sym_update_scalar): Rework optimization code
 +      to clean up the function.
 +
+ 2012-07-17         Andrew J. Schorr     <address@hidden>
+ 
+       * gawkapi.h: Add comments explaining new api_create_value and
+       api_release_value functions.
+       * gawkapi.c (sym_update_real): Allow updates with AWK_SCALAR and
+       AWK_VALUE_COOKIE types.  After creating a regular variable,
+       remove the call to unref(node->var_value), since this is not
+       done elsewhere in the code (see, for example, main.c:init_vars).
+       If the update is for an existing variable, allow any val_type
+       except AWK_ARRAY (was previously disallowing AWK_SCALAR and
+       AWK_VALUE_COOKIE for no apparent reason).
+       (api_sym_update_scalar): The switch should return false for an
+       invalid val_type value, so change the AWK_ARRAY case to default.
+       (valid_subscript_type): Any scalar value is good, so accept any valid
+       type except AWK_ARRAY.
+       (api_create_value): Accept only AWK_NUMBER and AWK_STRING values.
+       Anything else should fail.
+ 
  2012-07-17         Arnold D. Robbins     <address@hidden>
  
        Speedup:

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=91049b1eef7366b3223e36125d6cfca898f8c3dd

commit 91049b1eef7366b3223e36125d6cfca898f8c3dd
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Jul 20 12:04:53 2012 +0300

    Add initial man pages for some of the extensions.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 66c88ec..80cb44d 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-20         Arnold D. Robbins     <address@hidden>
+
+       * filefuncs.3am, fnmatch.3am, ordchr.3am, readfile.3am:
+       new files.
+
 2012-07-16         Arnold D. Robbins     <address@hidden>
 
        * fnmatch.c: Simplify flag table.
diff --git a/extension/filefuncs.3am b/extension/filefuncs.3am
new file mode 100644
index 0000000..3e606bc
--- /dev/null
+++ b/extension/filefuncs.3am
@@ -0,0 +1,342 @@
+.TH FILEFUNCS 3am "Jul 15 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.SH NAME
+filefuncs \- provide some file related functionality to gawk
+.SH SYNOPSIS
+.ft CW
address@hidden "filefuncs"
+.sp
+result = chdir("/some/directory")
+.sp
+result = stat("/some/path", statdata)
+.sp
+flags = or(FTS_PHYSICAL, ...)
+.br
+result = fts(pathlist, flags, filedata)
+.ft R
+.SH DESCRIPTION
+The
+.I filefuncs
+extension adds several functions that provide access to
+file-related facilities.
+.SS chdir()
+The
+.B chdir()
+function is a direct hook to the
+.IR chdir (2)
+system call to change the current directory.
+It returns zero
+upon success or less than zero upon error.
+In the latter case it updates
+.BR ERRNO .
+.SS stat()
+The
+.B stat()
+function provides a hook into the
+.IR stat (2)
+system call. In fact, it uses
+.IR lstat (2).
+It returns zero
+upon success or less than zero upon error.
+In the latter case it updates
+.BR ERRNO .
+.PP
+In all cases, it clears the
+.B statdata
+array.
+When the call is successful,
+.B stat()
+fills the
+.B statdata
+array with information retrieved from the filesystem, as follows:
+.TP
+\fBstatdata["name"]\fP
+The name of the file.
+.TP
+\fBstatdata["dev"]\fP
+Corresponds to the
+.I st_dev
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["ino"]\fP
+Corresponds to the
+.I st_ino
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["mode"]\fP
+Corresponds to the
+.I st_mode
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["nlink"]\fP
+Corresponds to the
+.I st_nlink
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["uid"]\fP
+Corresponds to the
+.I st_uid
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["gid"]\fP
+Corresponds to the
+.I st_gid
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["size"]\fP
+Corresponds to the
+.I st_size
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["atime"]\fP
+Corresponds to the
+.I st_atime
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["mtime"]\fP
+Corresponds to the
+.I st_mtime
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["ctime"]\fP
+Corresponds to the
+.I st_ctime
+field in the
+.IR "struct stat" .
+.TP
+\fBstatdata["rdev"]\fP
+Corresponds to the
+.I st_rdev
+field in the
+.IR "struct stat" .
+This element is only present for device files.
+.TP
+\fBstatdata["major"]\fP
+Corresponds to the
+.I st_major
+field in the
+.IR "struct stat" .
+This element is only present for device files.
+.TP
+\fBstatdata["minor"]\fP
+Corresponds to the
+.I st_minor
+field in the
+.IR "struct stat" .
+This element is only present for device files.
+.TP
+\fBstatdata["blksize"]\fP
+Corresponds to the
+.I st_blksize
+field in the
+.IR "struct stat" ,
+if this field is present on your system.
+(It is present on all modern systems that we know of.)
+.TP
+\fBstatdata["pmode"]\fP
+A human-readable version of the mode value, such as printed by
+.IR ls (1).
+For example, \fB"-rwxr-xr-x"\fP.
+.TP
+\fBstatdata["linkval"]\fP
+If the named file is a symbolic link, this element will exist
+and its value is the value of the symbolic link (where the
+symbolic link points to).
+.TP
+\fBstatdata["type"]\fP
+The type of the file as a string. One of
+\fB"file"\fP,
+\fB"blockdev"\fP,
+\fB"chardev"\fP,
+\fB"directory"\fP,
+\fB"socket"\fP,
+\fB"fifo"\fP,
+\fB"symlink"\fP,
+\fB"door"\fP,
+or
+\fB"unknown"\fP.
+Not all systems support all file types.
+.SS fts()
+The
+.B fts()
+function provides a hook to the
+.IR fts (3)
+set of routines for traversing file heirarchies.
+Instead of returning data about one file at a time in a ``stream,''
+it fills in a multi-dimensional array with data about each file and
+directory encountered in the requested heirarchies.
+.PP
+The arguments are as follows:
+.TP
+.B pathlist
+An array of filenames.  The element values are used; the index values are 
ignored.
+.TP
+.B flags
+This should be the bitwise OR of one or more of the following
+predefined constant flag values.  At least one of
+.B FTS_LOGICAL
+or
+.B FTS_PHYSICAL
+must be provided; otherwise
+.B fts()
+returns an error value.
+.RS
+.TP
+.B FTS_LOGICAL
+Do a ``logical'' file traversal, where the information returned for
+a symbolic link refers to the linked-to file, and not to the
+symbolic link itself.
+.TP
+.B FTS_PHYSICAL
+Do a ``physical'' file traversal, where the information returned for
+a symbolic link refers to the symbolic link itself.
+.TP
+.B FTS_NOCHDIR
+As a performance optimization, the
+.IR fts (3)
+routines change directory as they traverse a file heirarchy.
+This flag disables that optimization.
+.TP
+.B FTS_COMFOLLOW
+Immediatly follow a symbolic link named in
+.BR pathlist ,
+whether or not
+.B FTS_LOGICAL
+is set.
+.TP
+.B FTS_SEEDOT
+By default, the
+.IR fts (3)
+routines do not return entries for ``.'' and ``..''.
+This option causes entries for ``..'' to also be included.
+(The AWK extension always includes an entry for ``.'', see below.)
+.TP
+.B FTS_XDEV
+During a traversal, do not cross onto a different mounted filesystem.
+.RE
+.TP
+.B filedata
+The
+.B filedata
+array is first cleared.
+Then,
+.B fts()
+creates an element in
+.B filedata
+for every element in
+.BR pathlist .
+The index is the name of the directory or file given in
+.BR pathlist .
+The element for this index is itself an array.
+There are two cases.
+.RS
+.TP
+The path is a file.
+In this case, the array contains at two or three elements:
+.RS
+.TP
+\fB"path"\fP
+The full path to this file, starting from the ``root'' that was given
+in the
+.B pathlist
+array.
+.TP
+\fB"stat"\fP
+This element is itself an array, containing the same information as provided
+by the
+.B stat()
+function described earlier for its
+.B statdata
+argument.
+The element may not be present if
+.IR stat (2)
+for the file failed.
+.TP
+\fB"error"\fP
+If some kind of error was encountered, the array will also
+contain an element named \fB"error"\fP, which is a string describing the error.
+.RE
+.TP
+The path is a directory.
+In this case, the array contains one element for each entry in the directory.
+If an entry is a file, that element is as for files, just described.
+If the entry is a directory, that element is (recursively), an array describing
+the subdirectory.
+If
+.B FTS_SEEDOT
+was provided in the flags, then there will also be an element named
+\fB".."\fP.  This element will be an array containing the data
+as provided by
+.BR stat() .
+.sp
+In addition, there will be an element whose index is \fB"."\fP.
+This element is an array containing the same two or three elements
+as for a file:
+\fB"path"\fP,
+\fB"stat"\fP,
+and
+\fB"error"\fP.
+.RE
+.PP
+The
+.B fts()
+function returns 0 if there were no errors. Otherwise it returns \-1.
+.SH NOTES
+The AWK extension does not exactly mimic the interface of the
+.IR fts (3)
+routines, choosing instead to provide an interface that is based
+on associative arrays, which should be more comfortable to use from
+an AWK program.  This includes the lack of a comparison function, since
+.I gawk
+already provides powerful array sorting facilities.  While an
+.IR fts_read() \-like
+interface could have been provided, this felt less natural than
+simply creating a multi-dimensional array to represent the file
+heirarchy and its information.
+... .SH BUGS
+.SH EXAMPLE
+.ft CW
+.nf
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR "GAWK: Effective AWK Programming" ,
+.IR fnmatch (3am),
+.IR ordchr (3am),
+.IR readfile (3am),
+.IR rwarray (3am),
+.IR time (3am).
+.SH AUTHOR
+Arnold Robbins,
+.BR address@hidden .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.
diff --git a/extension/fnmatch.3am b/extension/fnmatch.3am
new file mode 100644
index 0000000..eefa5dc
--- /dev/null
+++ b/extension/fnmatch.3am
@@ -0,0 +1,116 @@
+.TH FNMATCH 3am "Jul 12 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.SH NAME
+fnmatch \- compare a string against a filename wildcard
+.SH SYNOPSIS
+.ft CW
address@hidden "fnmatch"
+.br
+result = fnmatch(pattern, string, flags)
+.ft R
+.SH DESCRIPTION
+The
+.I fnmatch
+extension provides an AWK interface to the
+.IR fnmatch (3)
+routine.  It adds a single function named
+.BR fnmatch() ,
+one constant
+.RB ( FNM_NOMATCH ),
+and an array of flag values named
+.BR FNM .
+.PP
+The first argument is the filename wildcard to match, the second
+is the filename string, and the third is either zero,
+or the bitwise OR of one or more of the flags in the
+.B FNM
+array.
+.PP
+The return value is zero on success,
+.B FNM_NOMATCH
+if the string did not match the pattern, or
+a different non-zero value if an error occurred.
+.PP
+The flags are follows:
+.TP
+\fBFNM["CASEFOLD"]\fP
+Corresponds to the
+.B FNM_CASEFOLD
+flag as defined in
+.IR fnmatch (3).
+.TP
+\fBFNM["FILE_NAME"]\fP
+Corresponds to the
+.B FNM_FILE_NAME
+flag as defined in
+.IR fnmatch (3).
+.TP
+\fBFNM["LEADING_DIR"]\fP
+Corresponds to the
+.B FNM_LEADING_DIR
+flag as defined in
+.IR fnmatch (3).
+.TP
+\fBFNM["NOESCAPE"]\fP
+Corresponds to the
+.B FNM_NOESCAPE
+flag as defined in
+.IR fnmatch (3).
+.TP
+\fBFNM["PATHNAME"]\fP
+Corresponds to the
+.B FNM_PATHNAME
+flag as defined in
+.IR fnmatch (3).
+.TP
+\fBFNM["PERIOD"]\fP
+Corresponds to the
+.B FNM_PERIOD
+flag as defined in
+.IR fnmatch (3).
+.PP
+... .SH NOTES
+... .SH BUGS
+.SH EXAMPLE
+.ft CW
+.nf
address@hidden "fnmatch"
+\&...
+flags = or(FNM["PERIOD"], FNM["NOESCAPE"])
+if (fnmatch("*.a", "foo.c", flags) == FNM_NOMATCH)
+       print "no match"
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR fnmatch (3),
+.IR "GAWK: Effective AWK Programming" ,
+.IR filefuncs (3am),
+.IR ordchr (3am),
+.IR readfile (3am),
+.IR rwarray (3am),
+.IR time (3am).
+.SH AUTHOR
+Arnold Robbins,
+.BR address@hidden .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.
diff --git a/extension/ordchr.3am b/extension/ordchr.3am
new file mode 100644
index 0000000..f2aec9c
--- /dev/null
+++ b/extension/ordchr.3am
@@ -0,0 +1,74 @@
+.TH ORDCHR 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.SH NAME
+ordchr \- convert characters to strings and vice versa
+.SH SYNOPSIS
+.ft CW
address@hidden "ordchr"
+.br
+number = ord("A")
+.br
+string = chr(65)
+.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.
+.PP
+These functions are inspired by the Pascal language functions
+of the same name.
+... .SH NOTES
+... .SH BUGS
+.SH EXAMPLE
+.ft CW
+.nf
address@hidden "ordchr"
+\&...
+printf("The numeric value of 'A' is %d\en", ord("A"))
+printf("The string value of 65 is %s\en", chr(65))
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR "GAWK: Effective AWK Programming" ,
+.IR filefuncs (3am),
+.IR fnmatch (3am),
+.IR readfile (3am),
+.IR rwarray (3am),
+.IR time (3am).
+.SH AUTHOR
+Arnold Robbins,
+.BR address@hidden .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.
diff --git a/extension/readfile.3am b/extension/readfile.3am
new file mode 100644
index 0000000..76a38ca
--- /dev/null
+++ b/extension/readfile.3am
@@ -0,0 +1,67 @@
+.TH READFILE 3am "Jul 11 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.SH NAME
+readfile \- return the entire contents of a file as a string
+.SH SYNOPSIS
+.ft CW
address@hidden "readfile"
+.br
+result = readfile("/some/path")
+.ft R
+.SH DESCRIPTION
+The
+.I readfile
+extension adds a single function named
+.BR readfile() .
+The argument is the name of the file to read.
+The return value is a string containing the entire contents of
+the requested file.
+.PP
+Upon error, the function returns the empty string and sets
+.BR ERRNO .
+... .SH NOTES
+... .SH BUGS
+.SH EXAMPLE
+.ft CW
+.nf
address@hidden "readfile"
+\&...
+contents = readfile("/path/to/file");
+if (contents == "" && ERRNO != "") {
+       print("problem reading file", ERRNO) > "/dev/stderr"
+       ...
+}
+.fi
+.ft R
+.SH "SEE ALSO"
+.IR "GAWK: Effective AWK Programming" ,
+.IR filefuncs (3am),
+.IR fnmatch (3am),
+.IR ordchr (3am),
+.IR rwarray (3am),
+.IR time (3am).
+.SH AUTHOR
+Arnold Robbins,
+.BR address@hidden .
+.SH COPYING PERMISSIONS
+Copyright \(co 2012
+Free Software Foundation, Inc.
+.PP
+Permission is granted to make and distribute verbatim copies of
+this manual page provided the copyright notice and this permission
+notice are preserved on all copies.
+.ig
+Permission is granted to process this file through troff and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual page).
+..
+.PP
+Permission is granted to copy and distribute modified versions of this
+manual page under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+.PP
+Permission is granted to copy and distribute translations of this
+manual page into another language, under the above conditions for
+modified versions, except that this permission notice may be stated in
+a translation approved by the Foundation.

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=50831fa7f402480d83d5e3647d09acdad7cd0eeb

commit 50831fa7f402480d83d5e3647d09acdad7cd0eeb
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Jul 20 12:00:31 2012 +0300

    Update doc in header. Redo update_scalar.

diff --git a/ChangeLog b/ChangeLog
index 2ebb17d..6aeaf89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-20         Arnold D. Robbins     <address@hidden>
+
+       * gawkapi.h: Rework table to not take up so much space.
+       * gawkapi.c (api_sym_update_scalar): Rework optimization code
+       to clean up the function.
+
 2012-07-17         Arnold D. Robbins     <address@hidden>
 
        Speedup:
diff --git a/gawkapi.c b/gawkapi.c
index c750f06..8dd900e 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -589,57 +589,51 @@ api_sym_update_scalar(awk_ext_id_t id,
 
        switch (value->val_type) {
        case AWK_NUMBER:
-               if (node->var_value->valref == 1 && ! do_mpfr) {
+       case AWK_STRING:
+               /* try for optimization */
+               if (node->var_value->valref == 1) {
                        NODE *r = node->var_value;
 
-                       r->numbr = value->num_value;
+                       if (value->val_type == AWK_NUMBER && do_mpfr)
+                               break;  /* break switch, do it the hard way */
+
+                       /* release the old string value if any */
                        if (r->flags & STRCUR) {
-                               efree(r->stptr);
+                               if (r->flags & MALLOC)
+                                       efree(r->stptr);
                                r->stptr = NULL;
                                r->stlen = 0;
                        }
                        free_wstr(r);
-                       r->flags = MALLOC|NUMBER|NUMCUR;
+
+                       if (value->val_type == AWK_NUMBER) {
+                               r->flags = MALLOC|NUMBER|NUMCUR;
+                               r->numbr = value->num_value;
+                       } else {
+                               r->flags &= ~(NUMBER|NUMCUR);
+                               r->flags |= (STRING|STRCUR|MALLOC);
+                               r->stfmt = -1;
+                               r->stptr = value->str_value.str;
+                               r->stlen = value->str_value.len;
+                       }
+
                        return true;
                }
-               /* otherwise, fall through */
-
+               /* else
+                       fall through */
        case AWK_UNDEFINED:
        case AWK_SCALAR:
        case AWK_VALUE_COOKIE:
-               break;
-       case AWK_STRING:
-               /* convert value to string, optimized */
-               if (node->var_value->valref == 1) {
-                       new_value = node->var_value;
-                       free_wstr(new_value);
-                       new_value->flags &= ~(NUMBER|NUMCUR);
-                       new_value->stfmt = -1;
-
-                       if ((new_value->flags & STRING) != 0) {
-                               if ((new_value->flags & MALLOC) != 0) {
-                                       efree(new_value->stptr);
-                               }
-                       }
+               unref(node->var_value);
+               node->var_value = awk_value_to_node(value);
 
-                       new_value->stptr = value->str_value.str;
-                       new_value->stlen = value->str_value.len;
-                       new_value->flags |= (STRING|STRCUR|MALLOC);
+               return true;
 
-                       return true;
-               }
-               break;
        case AWK_ARRAY:
-               return false;
                break;
        }
 
-       /* do it the harder way */
-
-       unref(node->var_value);
-       node->var_value = awk_value_to_node(value);
-
-       return true;
+       return false;
 }
 
 /*
diff --git a/gawkapi.h b/gawkapi.h
index 29631cd..5cc8fc1 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -232,23 +232,28 @@ typedef struct gawk_api {
 
        Table entry is type returned:
 
-                             
+---------------------------------------------------+
-                             |                    Type Requested:              
  |
-                             
+----------+----------+-------+---------+-----------+
-                             |  String  |  Number  | Array | Scalar  | 
Undefined |
-       
+---------+-----------+----------+----------+-------+---------+-----------+
-       | Type    | String    |  String  | Number if| false | Scalar  |   
String  |
-       |         |           |          | it can be|       |         |         
  |
-       |         |           |          |converted,|       |         |         
  |
-       |         |           |          |   else   |       |         |         
  |
-       |         |           |          |   false  |       |         |         
  |
-       | of      
+-----------+----------+----------+-------+---------+-----------+
-       | Actual  | Number    |  String  |  Number  | false | Scalar  |  Number 
  |
-       | Value:  
+-----------+----------+----------+-------+---------+-----------+
-       |         | Array     |   false  |   false  | Array | false   |  Array  
  |
-       |         
+-----------+----------+----------+-------+---------+-----------+
-       |         | Undefined |   false  |   false  | false | false   | 
Undefined |
-       
+---------+-----------+----------+----------+-------+---------+-----------+
+
+                               
+-------------------------------------------------+
+                               |                Type of Actual Value:          
  |
+                               
+------------+------------+-----------+-----------+
+                               |   String   |   Number   | Array     | 
Undefined |
+       
+-----------+-----------+------------+------------+-----------+-----------+
+       |           | String    |   String   |   String   | false     | false   
  |
+       |           
|-----------+------------+------------+-----------+-----------+
+       |           | Number    | Number if  |   Number   | false     | false   
  |
+       |           |           | can be     |            |           |         
  |
+       |           |           | converted, |            |           |         
  |
+       |           |           | else false |            |           |         
  |
+       |           
|-----------+------------+------------+-----------+-----------+
+       |   Type    | Array     |   false    |   false    | Array     | false   
  |
+       | Requested 
|-----------+------------+------------+-----------+-----------+
+       |           | Scalar    |   Scalar   |   Scalar   | false     | false   
  |
+       |           
|-----------+------------+------------+-----------+-----------+
+       |           | Undefined |  String    |   Number   | Array     | 
Undefined |
+       |           
|-----------+------------+------------+-----------+-----------+
+       |           | Value     |   false    |   false    | false     | false   
  |
+       |           | Cookie    |            |            |           |         
  |
+       
+-----------+-----------+------------+------------+-----------+-----------+
        */
 
        /*

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

Summary of changes:
 ChangeLog               |    6 +
 extension/ChangeLog     |    5 +
 extension/filefuncs.3am |  342 +++++++++++++++++++++++++++++++++++++++++++++++
 extension/fnmatch.3am   |  116 ++++++++++++++++
 extension/ordchr.3am    |   74 ++++++++++
 extension/readfile.3am  |   67 +++++++++
 gawkapi.c               |   62 ++++-----
 gawkapi.h               |   39 +++---
 8 files changed, 660 insertions(+), 51 deletions(-)
 create mode 100644 extension/filefuncs.3am
 create mode 100644 extension/fnmatch.3am
 create mode 100644 extension/ordchr.3am
 create mode 100644 extension/readfile.3am


hooks/post-receive
-- 
gawk



reply via email to

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