diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-25 20:26:03 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-25 20:26:03 +0200 |
commit | 11d4249864512d100a938559e044876f2fd3171f (patch) | |
tree | 798873699395711ba6f8ae144f20357a35b3d6b6 | |
parent | cec0cbdbda6a8b27d3f69eb5e2984d87b55f78fb (diff) | |
download | egawk-11d4249864512d100a938559e044876f2fd3171f.tar.gz egawk-11d4249864512d100a938559e044876f2fd3171f.tar.bz2 egawk-11d4249864512d100a938559e044876f2fd3171f.zip |
Remove sym_constant() API and tests.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 220 | ||||
-rw-r--r-- | doc/gawk.texi | 11 | ||||
-rw-r--r-- | extension/ChangeLog | 9 | ||||
-rw-r--r-- | extension/filefuncs.3am | 10 | ||||
-rw-r--r-- | extension/filefuncs.c | 4 | ||||
-rw-r--r-- | extension/fnmatch.3am | 10 | ||||
-rw-r--r-- | extension/fnmatch.c | 2 | ||||
-rw-r--r-- | extension/testext.c | 4 | ||||
-rw-r--r-- | gawkapi.c | 43 | ||||
-rw-r--r-- | gawkapi.h | 7 | ||||
-rw-r--r-- | test/ChangeLog | 7 | ||||
-rw-r--r-- | test/Makefile.am | 11 | ||||
-rw-r--r-- | test/Makefile.in | 11 | ||||
-rw-r--r-- | test/assignconst.awk | 58 | ||||
-rw-r--r-- | test/assignconst.ok | 42 |
17 files changed, 158 insertions, 306 deletions
@@ -1,3 +1,14 @@ +2012-12-25 Arnold D. Robbins <arnold@skeeve.com> + + Remove sym-constant from API after discussions with John + Haque and Andy Schorr. + + * gawkapi.h (api_sym_constant): Removed field in API struct. + (sym_constant): Remove macro. + * gawkapi.c (set_constant, api_sym_update, api_sym_constant): Removed. + (sym_update_real): Renamed to api_sym_update(). is_const parameter + removed and code adjusted. + 2012-12-23 Arnold D. Robbins <arnold@skeeve.com> * 4.0.2: Release tar ball made. diff --git a/doc/ChangeLog b/doc/ChangeLog index b5552676..d74b556f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2012-12-25 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi: Remove doc sym_constant() API function. + 2012-12-23 Arnold D. Robbins <arnold@skeeve.com> * 4.0.2: Release tar ball made. diff --git a/doc/gawk.info b/doc/gawk.info index 55595e70..50d23536 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -22553,21 +22553,6 @@ termed a "symbol table". an array. This routine cannot be used to update any of the predefined variables (such as `ARGC' or `NF'). -`awk_bool_t sym_constant(const char *name, awk_value_t *value);' - Create a variable named by the string `name', which is a regular C - string, that has the constant value as given by `value'. - `awk'-level code cannot change the value of this variable.(1) The - extension may change the value of `name''s variable with - subsequent calls to this routine, and may also convert a variable - created by `sym_update()' into a constant. However, once a - variable becomes a constant, it cannot later be reverted into a - mutable variable. - - ---------- Footnotes ---------- - - (1) There (currently) is no `awk'-level feature that provides this -ability. - File: gawk.info, Node: Symbol table by cookie, Next: Cached values, Prev: Symbol table by name, Up: Symbol Table Access @@ -32258,108 +32243,107 @@ Node: Updating `ERRNO'909439 Node: Accessing Parameters910178 Node: Symbol Table Access911408 Node: Symbol table by name911920 -Ref: Symbol table by name-Footnote-1914090 -Node: Symbol table by cookie914170 -Ref: Symbol table by cookie-Footnote-1918299 -Node: Cached values918362 -Ref: Cached values-Footnote-1921805 -Node: Array Manipulation921896 -Ref: Array Manipulation-Footnote-1922994 -Node: Array Data Types923033 -Ref: Array Data Types-Footnote-1925736 -Node: Array Functions925828 -Node: Flattening Arrays929594 -Node: Creating Arrays936433 -Node: Extension API Variables941228 -Node: Extension Versioning941864 -Node: Extension API Informational Variables943765 -Node: Extension API Boilerplate944851 -Node: Finding Extensions948682 -Node: Extension Example949229 -Node: Internal File Description949967 -Node: Internal File Ops953655 -Ref: Internal File Ops-Footnote-1965102 -Node: Using Internal File Ops965242 -Ref: Using Internal File Ops-Footnote-1967595 -Node: Extension Samples967861 -Node: Extension Sample File Functions969304 -Node: Extension Sample Fnmatch977777 -Node: Extension Sample Fork979503 -Node: Extension Sample Ord980717 -Node: Extension Sample Readdir981493 -Node: Extension Sample Revout982997 -Node: Extension Sample Rev2way983590 -Node: Extension Sample Read write array984280 -Node: Extension Sample Readfile986163 -Node: Extension Sample API Tests986918 -Node: Extension Sample Time987443 -Node: gawkextlib988750 -Node: Language History991131 -Node: V7/SVR3.1992653 -Node: SVR4994974 -Node: POSIX996416 -Node: BTL997424 -Node: POSIX/GNU998229 -Node: Common Extensions1003764 -Node: Ranges and Locales1004823 -Ref: Ranges and Locales-Footnote-11009441 -Ref: Ranges and Locales-Footnote-21009468 -Ref: Ranges and Locales-Footnote-31009728 -Node: Contributors1009949 -Node: Installation1014245 -Node: Gawk Distribution1015139 -Node: Getting1015623 -Node: Extracting1016449 -Node: Distribution contents1018141 -Node: Unix Installation1023402 -Node: Quick Installation1024019 -Node: Additional Configuration Options1025981 -Node: Configuration Philosophy1027458 -Node: Non-Unix Installation1029800 -Node: PC Installation1030258 -Node: PC Binary Installation1031557 -Node: PC Compiling1033405 -Node: PC Testing1036349 -Node: PC Using1037525 -Node: Cygwin1041710 -Node: MSYS1042710 -Node: VMS Installation1043224 -Node: VMS Compilation1043827 -Ref: VMS Compilation-Footnote-11044834 -Node: VMS Installation Details1044892 -Node: VMS Running1046527 -Node: VMS Old Gawk1048134 -Node: Bugs1048608 -Node: Other Versions1052460 -Node: Notes1057775 -Node: Compatibility Mode1058575 -Node: Additions1059358 -Node: Accessing The Source1060285 -Node: Adding Code1061888 -Node: New Ports1067930 -Node: Derived Files1072065 -Ref: Derived Files-Footnote-11077386 -Ref: Derived Files-Footnote-21077420 -Ref: Derived Files-Footnote-31078020 -Node: Future Extensions1078118 -Node: Implementation Limitations1078699 -Node: Extension Design1079951 -Node: Old Extension Problems1081100 -Ref: Old Extension Problems-Footnote-11082608 -Node: Extension New Mechanism Goals1082665 -Ref: Extension New Mechanism Goals-Footnote-11086024 -Node: Extension Other Design Decisions1086210 -Node: Extension Future Growth1088316 -Node: Old Extension Mechansim1089137 -Node: Basic Concepts1090894 -Node: Basic High Level1091575 -Ref: figure-general-flow1091846 -Ref: figure-process-flow1092445 -Ref: Basic High Level-Footnote-11095674 -Node: Basic Data Typing1095859 -Node: Glossary1099214 -Node: Copying1124525 -Node: GNU Free Documentation License1162082 -Node: Index1187219 +Node: Symbol table by cookie913493 +Ref: Symbol table by cookie-Footnote-1917622 +Node: Cached values917685 +Ref: Cached values-Footnote-1921128 +Node: Array Manipulation921219 +Ref: Array Manipulation-Footnote-1922317 +Node: Array Data Types922356 +Ref: Array Data Types-Footnote-1925059 +Node: Array Functions925151 +Node: Flattening Arrays928917 +Node: Creating Arrays935756 +Node: Extension API Variables940551 +Node: Extension Versioning941187 +Node: Extension API Informational Variables943088 +Node: Extension API Boilerplate944174 +Node: Finding Extensions948005 +Node: Extension Example948552 +Node: Internal File Description949290 +Node: Internal File Ops952978 +Ref: Internal File Ops-Footnote-1964425 +Node: Using Internal File Ops964565 +Ref: Using Internal File Ops-Footnote-1966918 +Node: Extension Samples967184 +Node: Extension Sample File Functions968627 +Node: Extension Sample Fnmatch977100 +Node: Extension Sample Fork978826 +Node: Extension Sample Ord980040 +Node: Extension Sample Readdir980816 +Node: Extension Sample Revout982320 +Node: Extension Sample Rev2way982913 +Node: Extension Sample Read write array983603 +Node: Extension Sample Readfile985486 +Node: Extension Sample API Tests986241 +Node: Extension Sample Time986766 +Node: gawkextlib988073 +Node: Language History990454 +Node: V7/SVR3.1991976 +Node: SVR4994297 +Node: POSIX995739 +Node: BTL996747 +Node: POSIX/GNU997552 +Node: Common Extensions1003087 +Node: Ranges and Locales1004146 +Ref: Ranges and Locales-Footnote-11008764 +Ref: Ranges and Locales-Footnote-21008791 +Ref: Ranges and Locales-Footnote-31009051 +Node: Contributors1009272 +Node: Installation1013568 +Node: Gawk Distribution1014462 +Node: Getting1014946 +Node: Extracting1015772 +Node: Distribution contents1017464 +Node: Unix Installation1022725 +Node: Quick Installation1023342 +Node: Additional Configuration Options1025304 +Node: Configuration Philosophy1026781 +Node: Non-Unix Installation1029123 +Node: PC Installation1029581 +Node: PC Binary Installation1030880 +Node: PC Compiling1032728 +Node: PC Testing1035672 +Node: PC Using1036848 +Node: Cygwin1041033 +Node: MSYS1042033 +Node: VMS Installation1042547 +Node: VMS Compilation1043150 +Ref: VMS Compilation-Footnote-11044157 +Node: VMS Installation Details1044215 +Node: VMS Running1045850 +Node: VMS Old Gawk1047457 +Node: Bugs1047931 +Node: Other Versions1051783 +Node: Notes1057098 +Node: Compatibility Mode1057898 +Node: Additions1058681 +Node: Accessing The Source1059608 +Node: Adding Code1061211 +Node: New Ports1067253 +Node: Derived Files1071388 +Ref: Derived Files-Footnote-11076709 +Ref: Derived Files-Footnote-21076743 +Ref: Derived Files-Footnote-31077343 +Node: Future Extensions1077441 +Node: Implementation Limitations1078022 +Node: Extension Design1079274 +Node: Old Extension Problems1080423 +Ref: Old Extension Problems-Footnote-11081931 +Node: Extension New Mechanism Goals1081988 +Ref: Extension New Mechanism Goals-Footnote-11085347 +Node: Extension Other Design Decisions1085533 +Node: Extension Future Growth1087639 +Node: Old Extension Mechansim1088460 +Node: Basic Concepts1090217 +Node: Basic High Level1090898 +Ref: figure-general-flow1091169 +Ref: figure-process-flow1091768 +Ref: Basic High Level-Footnote-11094997 +Node: Basic Data Typing1095182 +Node: Glossary1098537 +Node: Copying1123848 +Node: GNU Free Documentation License1161405 +Node: Index1186542 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 922f7ccd..575e9abd 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -29502,17 +29502,6 @@ Changing types (scalar to array or vice versa) of an existing variable is @emph{not} allowed, nor may this routine be used to update an array. This routine cannot be used to update any of the predefined variables (such as @code{ARGC} or @code{NF}). - -@item awk_bool_t sym_constant(const char *name, awk_value_t *value); -Create a variable named by the string @code{name}, which is -a regular C string, that has the constant value as given by -@code{value}. @command{awk}-level code cannot change the value of this -variable.@footnote{There (currently) is no @code{awk}-level feature that -provides this ability.} The extension may change the value of @code{name}'s -variable with subsequent calls to this routine, and may also convert -a variable created by @code{sym_update()} into a constant. However, -once a variable becomes a constant, it cannot later be reverted into a -mutable variable. @end table @node Symbol table by cookie diff --git a/extension/ChangeLog b/extension/ChangeLog index 73b64fb6..58bedfc6 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,12 @@ +2012-12-25 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.3am, fnmatch.3am: Predefined variables are no + longer constants. + * filefuncs.c (init_filefuncs): Use sym_update() instead of + sym_constant(). + * fnmatch.c (init_fnmatch): Ditto. + * testext.c (init_testext): Ditto. + 2012-12-23 Arnold D. Robbins <arnold@skeeve.com> * 4.0.2: Release tar ball made. diff --git a/extension/filefuncs.3am b/extension/filefuncs.3am index 23800c47..396502c6 100644 --- a/extension/filefuncs.3am +++ b/extension/filefuncs.3am @@ -1,4 +1,4 @@ -.TH FILEFUNCS 3am "Nov 21 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH FILEFUNCS 3am "Dec 25 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME filefuncs \- provide some file related functionality to gawk .SH SYNOPSIS @@ -185,7 +185,7 @@ An array of filenames. The element values are used; the index values are ignore .TP .B flags This should be the bitwise OR of one or more of the following -predefined constant flag values. At least one of +predefined flag values. At least one of .B FTS_LOGICAL or .B FTS_PHYSICAL @@ -312,6 +312,12 @@ already provides powerful array sorting facilities. While an interface could have been provided, this felt less natural than simply creating a multi-dimensional array to represent the file heirarchy and its information. +.PP +Nothing prevents AWK code from changing the predefined +.BI FTS_ xx +values, but doing so is may cause strange results when +the changed values are passed to +.BR fts() . .SH BUGS There are many more file-related functions for which AWK interfaces would be desirable. diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 85c05b2e..4f7173b4 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -406,8 +406,8 @@ init_filefuncs(void) for (i = 0; opentab[i].name != NULL; i++) { (void) make_number(opentab[i].value, & value); - if (! sym_constant(opentab[i].name, & value)) { - warning(ext_id, _("fts init: could not create constant %s"), + if (! sym_update(opentab[i].name, & value)) { + warning(ext_id, _("fts init: could not create variable %s"), opentab[i].name); errors++; } diff --git a/extension/fnmatch.3am b/extension/fnmatch.3am index c84e9ae1..61e7f384 100644 --- a/extension/fnmatch.3am +++ b/extension/fnmatch.3am @@ -1,4 +1,4 @@ -.TH FNMATCH 3am "Aug 08 2012" "Free Software Foundation" "GNU Awk Extension Modules" +.TH FNMATCH 3am "Dec 25 2012" "Free Software Foundation" "GNU Awk Extension Modules" .SH NAME fnmatch \- compare a string against a filename wildcard .SH SYNOPSIS @@ -14,7 +14,7 @@ extension provides an AWK interface to the .IR fnmatch (3) routine. It adds a single function named .BR fnmatch() , -one constant +one predefined variable .RB ( FNM_NOMATCH ), and an array of flag values named .BR FNM . @@ -68,7 +68,11 @@ Corresponds to the flag as defined in .IR fnmatch (3). .PP -... .SH NOTES +.SH NOTES +Nothing prevents AWK code from changing the predefined +variabale +.BR FNM_NOMATCH , +but doing so may cause strange results. ... .SH BUGS .SH EXAMPLE .ft CW diff --git a/extension/fnmatch.c b/extension/fnmatch.c index 727c9daf..c63fe136 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -148,7 +148,7 @@ init_fnmatch(void) awk_array_t new_array; int i; - if (! sym_constant("FNM_NOMATCH", make_number(FNM_NOMATCH, & value))) { + if (! sym_update("FNM_NOMATCH", make_number(FNM_NOMATCH, & value))) { warning(ext_id, _("fnmatch init: could not add FNM_NOMATCH variable")); errors++; } diff --git a/extension/testext.c b/extension/testext.c index 8f6735c1..f7bf08a5 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -853,8 +853,8 @@ BEGIN { */ /* install some variables */ - if (! sym_constant("answer_num", make_number(42, & value))) - printf("testext: sym_constant(\"answer_num\") failed!\n"); + if (! sym_update("answer_num", make_number(42, & value))) + printf("testext: sym_update(\"answer_num\") failed!\n"); if (! sym_update("message_string", make_const_string(message, strlen(message), & value))) @@ -26,7 +26,6 @@ #include "awk.h" static awk_bool_t node_to_awk_value(NODE *node, awk_value_t *result, awk_valtype_t wanted); -static void set_constant(); /* * api_get_argument --- get the count'th paramater, zero-based. @@ -539,13 +538,12 @@ api_sym_lookup_scalar(awk_ext_id_t id, return node_to_awk_value(node, result, wanted); } -/* api_sym_update_real --- update a symbol's value, see gawkapi.h for semantics */ +/* api_sym_update --- update a symbol's value, see gawkapi.h for semantics */ static awk_bool_t -sym_update_real(awk_ext_id_t id, +api_sym_update(awk_ext_id_t id, const char *name, - awk_value_t *value, - bool is_const) + awk_value_t *value) { NODE *node; NODE *array_node; @@ -586,8 +584,6 @@ sym_update_real(awk_ext_id_t id, node = install_symbol(estrdup((char *) name, strlen(name)), Node_var); node->var_value = awk_value_to_node(value); - if (is_const) - node->var_assign = set_constant; } return true; @@ -610,36 +606,12 @@ sym_update_real(awk_ext_id_t id, if (node->type == Node_var_new && value->val_type != AWK_UNDEFINED) node->type = Node_var; - /* let the extension change its own variable */ - if (is_const) - node->var_assign = set_constant; - return true; } return false; } -/* api_sym_update --- update a symbol, non-constant */ - -static awk_bool_t -api_sym_update(awk_ext_id_t id, - const char *name, - awk_value_t *value) -{ - return sym_update_real(id, name, value, false); -} - -/* api_sym_update --- update a symbol, constant */ - -static awk_bool_t -api_sym_constant(awk_ext_id_t id, - const char *name, - awk_value_t *value) -{ - return sym_update_real(id, name, value, true); -} - /* api_sym_update_scalar --- update a scalar cookie */ static awk_bool_t @@ -1117,7 +1089,6 @@ gawk_api_t api_impl = { /* Accessing and installing variables and constants */ api_sym_lookup, api_sym_update, - api_sym_constant, /* Accessing and modifying variables via scalar cookies */ api_sym_lookup_scalar, @@ -1160,14 +1131,6 @@ update_ext_api() api_impl.do_flags[0] = (do_lint ? 1 : 0); } -/* set_constant --- prevent awk code from changing a constant */ - -static void -set_constant() -{ - fatal(_("cannot assign to defined constant")); -} - /* print_ext_versions --- print the list */ extern void @@ -550,11 +550,6 @@ typedef struct gawk_api { const char *name, awk_value_t *value); - /* Install a constant value. Intended to be used only with scalars. */ - awk_bool_t (*api_sym_constant)(awk_ext_id_t id, - const char *name, - awk_value_t *value); - /* * A ``scalar cookie'' is an opaque handle that provide access * to a global variable or array. It is an optimization that @@ -713,8 +708,6 @@ typedef struct gawk_api { (api->api_sym_lookup_scalar(ext_id, scalar_cookie, wanted, result)) #define sym_update(name, value) \ (api->api_sym_update(ext_id, name, value)) -#define sym_constant(name, value) \ - (api->api_sym_constant(ext_id, name, value)) #define sym_update_scalar(scalar_cookie, value) \ (api->api_sym_update_scalar)(ext_id, scalar_cookie, value) diff --git a/test/ChangeLog b/test/ChangeLog index 1d015467..99dcebb6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,10 @@ +2012-12-25 Arnold D. Robbins <arnold@skeeve.com> + + * assignconst.awk, assignconst.ok: Removed. + * Makefile.am (EXTRA_DIST): Removed assignconst.awk, assignconst.ok. + (SHLIB_TESTS): Removed assignconst. + (assignconst): Removed test. + 2012-12-23 Arnold D. Robbins <arnold@skeeve.com> * 4.0.2: Release tar ball made. diff --git a/test/Makefile.am b/test/Makefile.am index 8f4ce48f..da67b059 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -102,8 +102,6 @@ EXTRA_DIST = \ asort.ok \ asorti.awk \ asorti.ok \ - assignconst.awk \ - assignconst.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -955,7 +953,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - assignconst fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ + fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ readdir readfile revout revtwoway rwarray testext time # List of the tests which should be run with --lint option: @@ -1683,13 +1681,6 @@ testext:: @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk -assignconst: - @echo $@ - @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; \ - do AWKPATH=$(srcdir) $(AWK) -f $@.awk $$i ; \ - done 2>&1 | grep -v at_exit > _$@ - @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ - readdir: @echo This test can fail on some filesystems. @echo $@ diff --git a/test/Makefile.in b/test/Makefile.in index 2316cf71..e4b22fd8 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -314,8 +314,6 @@ EXTRA_DIST = \ asort.ok \ asorti.awk \ asorti.ok \ - assignconst.awk \ - assignconst.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -1162,7 +1160,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - assignconst fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ + fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ readdir readfile revout revtwoway rwarray testext time @@ -2064,13 +2062,6 @@ testext:: @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk -assignconst: - @echo $@ - @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; \ - do AWKPATH=$(srcdir) $(AWK) -f $@.awk $$i ; \ - done 2>&1 | grep -v at_exit > _$@ - @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ - readdir: @echo This test can fail on some filesystems. @echo $@ diff --git a/test/assignconst.awk b/test/assignconst.awk deleted file mode 100644 index 907987c7..00000000 --- a/test/assignconst.awk +++ /dev/null @@ -1,58 +0,0 @@ -@load "testext" - -BEGIN { - print "" - print "test:", ARGV[1] - switch (ARGV[1] + 0) { - case 1: - answer_num = 43 - break - case 2: - ++answer_num - break - case 3: - --answer_num - break - case 4: - answer_num++ - break - case 5: - answer_num-- - break - case 6: - answer_num += 1 - break - case 7: - answer_num -= 1 - break - case 8: - answer_num *= 1 - break - case 9: - answer_num /= 1 - break - case 10: - answer_num ^= 1 - break - case 11: - answer_num = answer_num "foo" - break - case 12: - sub(/2/, "3", answer_num) - break - case 13: - a[1] = 1 - for (answer_num in a) - print answer_num, a[answer_num] - break - case 14: - test_func(answer_num) - break - } -} - -function test_func(val) -{ - val++ - print "in test_func, val now =", val -} diff --git a/test/assignconst.ok b/test/assignconst.ok deleted file mode 100644 index 97698b27..00000000 --- a/test/assignconst.ok +++ /dev/null @@ -1,42 +0,0 @@ - -test: 1 -gawk: assignconst.awk:8: fatal: cannot assign to defined constant - -test: 2 -gawk: assignconst.awk:11: fatal: cannot assign to defined constant - -test: 3 -gawk: assignconst.awk:14: fatal: cannot assign to defined constant - -test: 4 -gawk: assignconst.awk:17: fatal: cannot assign to defined constant - -test: 5 -gawk: assignconst.awk:20: fatal: cannot assign to defined constant - -test: 6 -gawk: assignconst.awk:23: fatal: cannot assign to defined constant - -test: 7 -gawk: assignconst.awk:26: fatal: cannot assign to defined constant - -test: 8 -gawk: assignconst.awk:29: fatal: cannot assign to defined constant - -test: 9 -gawk: assignconst.awk:32: fatal: cannot assign to defined constant - -test: 10 -gawk: assignconst.awk:35: fatal: cannot assign to defined constant - -test: 11 -gawk: assignconst.awk:38: fatal: cannot assign to defined constant - -test: 12 -gawk: assignconst.awk:41: fatal: cannot assign to defined constant - -test: 13 -gawk: assignconst.awk:45: fatal: cannot assign to defined constant - -test: 14 -in test_func, val now = 43 |