aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--awk.h1
-rw-r--r--awkgram.c2809
-rw-r--r--awkgram.y205
-rw-r--r--debug.c1
-rw-r--r--eval.c1
-rw-r--r--extension/ChangeLog4
-rw-r--r--interpret.h1
-rw-r--r--profile.c101
-rw-r--r--test/ChangeLog4
-rw-r--r--test/Makefile.am6
-rw-r--r--test/Makefile.in6
-rw-r--r--test/profile4.ok18
-rw-r--r--test/profile5.ok13007
14 files changed, 9184 insertions, 6998 deletions
diff --git a/ChangeLog b/ChangeLog
index eab657c5..62e23d3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -905,6 +905,24 @@
* debug.c (print_memory): Fix whitespace / indentation.
+2013-08-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (append_rule): Add attempt to insert any comment
+ before a rule. Commented out at the moment.
+
+2013-07-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (enum opcodeval): Add Op_comment.
+ * awkgram.y (comment): New variable to hold comment text.
+ (statement): Add saved comments to lists being built.
+ (allow_newline): Save comment text if necessary. Append if have
+ existing text.
+ (yylex): Ditto.
+ * debug.c (print_instruction): Handle Op_comment.
+ * eval.c (optypes): Add entry for Op_comment.
+ * interpret.h (r_interpret): Ditto.
+ * profile.c (pprint): For Op_comment, print the comment text.
+
2013-07-24 Arnold D. Robbins <arnold@skeeve.com>
* io.c (FAKE_FD_VALUE): Move definition from here ...
diff --git a/awk.h b/awk.h
index 0b76aea2..540238e0 100644
--- a/awk.h
+++ b/awk.h
@@ -668,6 +668,7 @@ typedef enum opcodeval {
Op_func,
+ Op_comment, /* for pretty printing */
Op_exec_count,
Op_breakpoint,
Op_lint,
diff --git a/awkgram.c b/awkgram.c
index 34099a0b..c9c539d9 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 3.0.2. */
+/* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.2"
+#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -62,7 +62,8 @@
/* Copy the first part of user declarations. */
-#line 26 "awkgram.y" /* yacc.c:339 */
+/* Line 371 of yacc.c */
+#line 26 "awkgram.y"
#ifdef GAWKDEBUG
#define YYDEBUG 12
@@ -127,6 +128,7 @@ static void check_funcs(void);
static ssize_t read_one_line(int fd, void *buffer, size_t count);
static int one_line_close(int fd);
+void split_comment(void);
static bool want_source = false;
static bool want_regexp = false; /* lexical scanning kludge */
@@ -186,6 +188,12 @@ static INSTRUCTION *ip_end;
static INSTRUCTION *ip_endfile;
static INSTRUCTION *ip_beginfile;
+static INSTRUCTION *comment = NULL;
+static INSTRUCTION *comment0 = NULL;
+static INSTRUCTION *commentf = NULL;
+
+static int func_first = 1;
+
static inline INSTRUCTION *list_create(INSTRUCTION *x);
static inline INSTRUCTION *list_append(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
@@ -197,13 +205,14 @@ extern double fmod(double x, double y);
#define is_identchar(c) (isalnum(c) || (c) == '_')
-#line 201 "awkgram.c" /* yacc.c:339 */
+/* Line 371 of yacc.c */
+#line 210 "awkgram.c"
-# ifndef YY_NULLPTR
+# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# define YY_NULL nullptr
# else
-# define YY_NULLPTR 0
+# define YY_NULL 0
# endif
# endif
@@ -216,7 +225,7 @@ extern double fmod(double x, double y);
#endif
-/* Debug traces. */
+/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@@ -224,63 +233,64 @@ extern double fmod(double x, double y);
extern int yydebug;
#endif
-/* Token type. */
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- FUNC_CALL = 258,
- NAME = 259,
- REGEXP = 260,
- FILENAME = 261,
- YNUMBER = 262,
- YSTRING = 263,
- RELOP = 264,
- IO_OUT = 265,
- IO_IN = 266,
- ASSIGNOP = 267,
- ASSIGN = 268,
- MATCHOP = 269,
- CONCAT_OP = 270,
- SUBSCRIPT = 271,
- LEX_BEGIN = 272,
- LEX_END = 273,
- LEX_IF = 274,
- LEX_ELSE = 275,
- LEX_RETURN = 276,
- LEX_DELETE = 277,
- LEX_SWITCH = 278,
- LEX_CASE = 279,
- LEX_DEFAULT = 280,
- LEX_WHILE = 281,
- LEX_DO = 282,
- LEX_FOR = 283,
- LEX_BREAK = 284,
- LEX_CONTINUE = 285,
- LEX_PRINT = 286,
- LEX_PRINTF = 287,
- LEX_NEXT = 288,
- LEX_EXIT = 289,
- LEX_FUNCTION = 290,
- LEX_BEGINFILE = 291,
- LEX_ENDFILE = 292,
- LEX_GETLINE = 293,
- LEX_NEXTFILE = 294,
- LEX_IN = 295,
- LEX_AND = 296,
- LEX_OR = 297,
- INCREMENT = 298,
- DECREMENT = 299,
- LEX_BUILTIN = 300,
- LEX_LENGTH = 301,
- LEX_EOF = 302,
- LEX_INCLUDE = 303,
- LEX_EVAL = 304,
- LEX_LOAD = 305,
- NEWLINE = 306,
- SLASH_BEFORE_EQUAL = 307,
- UNARY = 308
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ FUNC_CALL = 258,
+ NAME = 259,
+ REGEXP = 260,
+ FILENAME = 261,
+ YNUMBER = 262,
+ YSTRING = 263,
+ RELOP = 264,
+ IO_OUT = 265,
+ IO_IN = 266,
+ ASSIGNOP = 267,
+ ASSIGN = 268,
+ MATCHOP = 269,
+ CONCAT_OP = 270,
+ SUBSCRIPT = 271,
+ LEX_BEGIN = 272,
+ LEX_END = 273,
+ LEX_IF = 274,
+ LEX_ELSE = 275,
+ LEX_RETURN = 276,
+ LEX_DELETE = 277,
+ LEX_SWITCH = 278,
+ LEX_CASE = 279,
+ LEX_DEFAULT = 280,
+ LEX_WHILE = 281,
+ LEX_DO = 282,
+ LEX_FOR = 283,
+ LEX_BREAK = 284,
+ LEX_CONTINUE = 285,
+ LEX_PRINT = 286,
+ LEX_PRINTF = 287,
+ LEX_NEXT = 288,
+ LEX_EXIT = 289,
+ LEX_FUNCTION = 290,
+ LEX_BEGINFILE = 291,
+ LEX_ENDFILE = 292,
+ LEX_GETLINE = 293,
+ LEX_NEXTFILE = 294,
+ LEX_IN = 295,
+ LEX_AND = 296,
+ LEX_OR = 297,
+ INCREMENT = 298,
+ DECREMENT = 299,
+ LEX_BUILTIN = 300,
+ LEX_LENGTH = 301,
+ LEX_EOF = 302,
+ LEX_INCLUDE = 303,
+ LEX_EVAL = 304,
+ LEX_LOAD = 305,
+ NEWLINE = 306,
+ SLASH_BEFORE_EQUAL = 307,
+ UNARY = 308
+ };
#endif
/* Tokens. */
#define FUNC_CALL 258
@@ -335,23 +345,37 @@ extern int yydebug;
#define SLASH_BEFORE_EQUAL 307
#define UNARY 308
-/* Value type. */
+
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-
extern YYSTYPE yylval;
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
/* Copy the second part of user declarations. */
-#line 355 "awkgram.c" /* yacc.c:358 */
+/* Line 390 of yacc.c */
+#line 379 "awkgram.c"
#ifdef short
# undef short
@@ -365,8 +389,11 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#else
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -386,7 +413,8 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -408,33 +436,6 @@ typedef short int yytype_int16;
# endif
#endif
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -442,26 +443,24 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(N) (N)
#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+ int yyi;
#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+{
+ return yyi;
+}
#endif
-
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -479,7 +478,8 @@ typedef short int yytype_int16;
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
@@ -491,8 +491,8 @@ typedef short int yytype_int16;
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -508,7 +508,7 @@ typedef short int yytype_int16;
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -516,13 +516,15 @@ typedef short int yytype_int16;
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -532,7 +534,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -557,16 +559,16 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
#endif
@@ -585,7 +587,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (0)
+ while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -601,19 +603,17 @@ union yyalloc
#define YYNNTS 65
/* YYNRULES -- Number of rules. */
#define YYNRULES 188
-/* YYNSTATES -- Number of states. */
+/* YYNRULES -- Number of states. */
#define YYNSTATES 335
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 308
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -650,28 +650,117 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint16 yyprhs[] =
+{
+ 0, 0, 3, 4, 7, 10, 13, 16, 19, 22,
+ 25, 30, 35, 37, 40, 42, 44, 47, 49, 50,
+ 52, 57, 59, 61, 63, 65, 71, 73, 75, 77,
+ 80, 82, 84, 91, 92, 96, 98, 100, 101, 104,
+ 107, 109, 112, 115, 119, 121, 131, 138, 147, 156,
+ 169, 181, 183, 186, 189, 192, 195, 199, 200, 205,
+ 208, 209, 214, 215, 220, 225, 227, 228, 230, 231,
+ 234, 237, 243, 248, 250, 253, 256, 258, 260, 262,
+ 264, 266, 270, 271, 272, 276, 283, 293, 295, 298,
+ 299, 301, 302, 305, 306, 308, 310, 314, 316, 319,
+ 323, 324, 326, 327, 329, 331, 335, 337, 340, 344,
+ 348, 352, 356, 360, 364, 368, 372, 378, 380, 382,
+ 384, 387, 389, 391, 393, 395, 397, 399, 402, 404,
+ 408, 412, 416, 420, 424, 428, 432, 435, 438, 444,
+ 449, 453, 457, 461, 465, 469, 473, 475, 478, 482,
+ 487, 492, 494, 496, 498, 501, 504, 506, 508, 511,
+ 514, 516, 519, 524, 525, 527, 528, 531, 533, 536,
+ 538, 542, 544, 547, 550, 552, 555, 557, 561, 563,
+ 565, 566, 569, 572, 574, 575, 577, 579, 581
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int16 yyrhs[] =
+{
+ 76, 0, -1, -1, 76, 77, -1, 76, 105, -1,
+ 76, 47, -1, 76, 1, -1, 80, 81, -1, 80,
+ 89, -1, 84, 81, -1, 69, 48, 78, 89, -1,
+ 69, 50, 79, 89, -1, 6, -1, 6, 1, -1,
+ 1, -1, 6, -1, 6, 1, -1, 1, -1, -1,
+ 113, -1, 113, 55, 106, 113, -1, 17, -1, 18,
+ -1, 36, -1, 37, -1, 133, 88, 134, 136, 106,
+ -1, 4, -1, 3, -1, 83, -1, 69, 49, -1,
+ 45, -1, 46, -1, 35, 82, 67, 108, 135, 106,
+ -1, -1, 87, 86, 5, -1, 61, -1, 52, -1,
+ -1, 88, 90, -1, 88, 1, -1, 105, -1, 137,
+ 106, -1, 137, 106, -1, 133, 88, 134, -1, 104,
+ -1, 23, 67, 113, 135, 106, 133, 97, 106, 134,
+ -1, 26, 67, 113, 135, 106, 90, -1, 27, 106,
+ 90, 26, 67, 113, 135, 106, -1, 28, 67, 4,
+ 40, 130, 135, 106, 90, -1, 28, 67, 96, 137,
+ 106, 113, 137, 106, 96, 135, 106, 90, -1, 28,
+ 67, 96, 137, 106, 137, 106, 96, 135, 106, 90,
+ -1, 91, -1, 29, 89, -1, 30, 89, -1, 33,
+ 89, -1, 39, 89, -1, 34, 110, 89, -1, -1,
+ 21, 92, 110, 89, -1, 93, 89, -1, -1, 100,
+ 94, 101, 102, -1, -1, 22, 4, 95, 124, -1,
+ 22, 67, 4, 68, -1, 113, -1, -1, 93, -1,
+ -1, 97, 98, -1, 97, 1, -1, 24, 99, 138,
+ 106, 88, -1, 25, 138, 106, 88, -1, 7, -1,
+ 59, 7, -1, 58, 7, -1, 8, -1, 85, -1,
+ 31, -1, 32, -1, 111, -1, 67, 112, 135, -1,
+ -1, -1, 10, 103, 117, -1, 19, 67, 113, 135,
+ 106, 90, -1, 19, 67, 113, 135, 106, 90, 20,
+ 106, 90, -1, 51, -1, 105, 51, -1, -1, 105,
+ -1, -1, 56, 118, -1, -1, 109, -1, 4, -1,
+ 109, 139, 4, -1, 1, -1, 109, 1, -1, 109,
+ 139, 1, -1, -1, 113, -1, -1, 112, -1, 113,
+ -1, 112, 139, 113, -1, 1, -1, 112, 1, -1,
+ 112, 1, 113, -1, 112, 139, 1, -1, 131, 114,
+ 113, -1, 113, 41, 113, -1, 113, 42, 113, -1,
+ 113, 14, 113, -1, 113, 40, 130, -1, 113, 116,
+ 113, -1, 113, 53, 113, 54, 113, -1, 117, -1,
+ 13, -1, 12, -1, 52, 13, -1, 9, -1, 56,
+ -1, 115, -1, 57, -1, 118, -1, 119, -1, 117,
+ 118, -1, 120, -1, 118, 65, 118, -1, 118, 60,
+ 118, -1, 118, 61, 118, -1, 118, 62, 118, -1,
+ 118, 58, 118, -1, 118, 59, 118, -1, 38, 123,
+ 107, -1, 131, 43, -1, 131, 44, -1, 67, 112,
+ 135, 40, 130, -1, 117, 11, 38, 123, -1, 119,
+ 65, 118, -1, 119, 60, 118, -1, 119, 61, 118,
+ -1, 119, 62, 118, -1, 119, 58, 118, -1, 119,
+ 59, 118, -1, 85, -1, 63, 118, -1, 67, 113,
+ 135, -1, 45, 67, 111, 135, -1, 46, 67, 111,
+ 135, -1, 46, -1, 121, -1, 131, -1, 43, 131,
+ -1, 44, 131, -1, 7, -1, 8, -1, 59, 118,
+ -1, 58, 118, -1, 122, -1, 69, 122, -1, 3,
+ 67, 111, 135, -1, -1, 131, -1, -1, 125, 16,
+ -1, 126, -1, 125, 126, -1, 127, -1, 70, 112,
+ 71, -1, 127, -1, 128, 127, -1, 128, 16, -1,
+ 4, -1, 4, 129, -1, 130, -1, 66, 120, 132,
+ -1, 43, -1, 44, -1, -1, 72, 106, -1, 73,
+ 106, -1, 68, -1, -1, 137, -1, 74, -1, 54,
+ -1, 55, 106, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 200, 200, 202, 207, 208, 214, 226, 230, 241,
- 247, 252, 260, 268, 270, 275, 283, 285, 291, 292,
- 294, 320, 331, 342, 348, 357, 367, 369, 371, 377,
- 382, 383, 387, 406, 405, 439, 441, 446, 447, 460,
- 465, 466, 470, 472, 474, 481, 571, 613, 655, 768,
- 775, 782, 792, 801, 810, 819, 830, 846, 845, 869,
- 881, 881, 979, 979, 1012, 1042, 1048, 1049, 1055, 1056,
- 1063, 1068, 1080, 1094, 1096, 1104, 1109, 1111, 1119, 1121,
- 1130, 1131, 1139, 1144, 1144, 1155, 1159, 1167, 1168, 1171,
- 1173, 1178, 1179, 1188, 1189, 1194, 1199, 1205, 1207, 1209,
- 1216, 1217, 1223, 1224, 1229, 1231, 1236, 1238, 1246, 1251,
- 1260, 1267, 1269, 1271, 1287, 1297, 1304, 1306, 1311, 1313,
- 1315, 1323, 1325, 1330, 1332, 1337, 1339, 1341, 1391, 1393,
- 1395, 1397, 1399, 1401, 1403, 1405, 1419, 1424, 1429, 1454,
- 1460, 1462, 1464, 1466, 1468, 1470, 1475, 1479, 1511, 1513,
- 1519, 1525, 1538, 1539, 1540, 1545, 1550, 1554, 1558, 1573,
- 1586, 1591, 1627, 1645, 1646, 1652, 1653, 1658, 1660, 1667,
- 1684, 1701, 1703, 1710, 1715, 1723, 1733, 1745, 1754, 1758,
- 1762, 1766, 1770, 1774, 1777, 1779, 1783, 1787, 1791
+ 0, 207, 207, 209, 214, 215, 221, 233, 237, 248,
+ 254, 259, 267, 275, 277, 282, 290, 292, 298, 305,
+ 314, 340, 353, 365, 372, 382, 394, 396, 398, 404,
+ 409, 410, 414, 443, 442, 476, 478, 483, 489, 517,
+ 522, 523, 527, 529, 531, 538, 628, 670, 712, 825,
+ 832, 839, 849, 858, 867, 876, 887, 903, 902, 926,
+ 938, 938, 1036, 1036, 1069, 1099, 1105, 1106, 1112, 1113,
+ 1120, 1125, 1137, 1151, 1153, 1161, 1166, 1168, 1176, 1178,
+ 1187, 1188, 1196, 1201, 1201, 1212, 1216, 1224, 1225, 1228,
+ 1230, 1235, 1236, 1245, 1246, 1251, 1256, 1262, 1264, 1266,
+ 1273, 1274, 1280, 1281, 1286, 1288, 1293, 1295, 1303, 1308,
+ 1317, 1324, 1326, 1328, 1344, 1354, 1361, 1363, 1368, 1370,
+ 1372, 1380, 1382, 1387, 1389, 1394, 1396, 1398, 1448, 1450,
+ 1452, 1454, 1456, 1458, 1460, 1462, 1476, 1481, 1486, 1511,
+ 1517, 1519, 1521, 1523, 1525, 1527, 1532, 1536, 1568, 1570,
+ 1576, 1582, 1595, 1596, 1597, 1602, 1607, 1611, 1615, 1630,
+ 1643, 1648, 1684, 1702, 1703, 1709, 1710, 1715, 1717, 1724,
+ 1741, 1758, 1760, 1767, 1772, 1780, 1790, 1802, 1811, 1815,
+ 1819, 1823, 1827, 1831, 1834, 1836, 1840, 1844, 1848
};
#endif
@@ -704,13 +793,13 @@ static const char *const yytname[] =
"func_call", "direct_func_call", "opt_variable", "delete_subscript_list",
"delete_subscript", "delete_exp_list", "bracketed_exp_list", "subscript",
"subscript_list", "simple_variable", "variable", "opt_incdec", "l_brace",
- "r_brace", "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR
+ "r_brace", "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULL
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -724,59 +813,57 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -273
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-273)))
-
-#define YYTABLE_NINF -104
-
-#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-104)))
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 75, 76, 76, 76, 76, 76, 77, 77, 77,
+ 77, 77, 78, 78, 78, 79, 79, 79, 80, 80,
+ 80, 80, 80, 80, 80, 81, 82, 82, 82, 82,
+ 83, 83, 84, 86, 85, 87, 87, 88, 88, 88,
+ 89, 89, 90, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 91, 91, 91, 91, 91, 92, 91, 91,
+ 94, 93, 95, 93, 93, 93, 96, 96, 97, 97,
+ 97, 98, 98, 99, 99, 99, 99, 99, 100, 100,
+ 101, 101, 102, 103, 102, 104, 104, 105, 105, 106,
+ 106, 107, 107, 108, 108, 109, 109, 109, 109, 109,
+ 110, 110, 111, 111, 112, 112, 112, 112, 112, 112,
+ 113, 113, 113, 113, 113, 113, 113, 113, 114, 114,
+ 114, 115, 115, 116, 116, 117, 117, 117, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 119,
+ 119, 119, 119, 119, 119, 119, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 121, 121, 122, 123, 123, 124, 124, 125, 125, 126,
+ 127, 128, 128, 129, 130, 130, 131, 131, 132, 132,
+ 132, 133, 134, 135, 136, 136, 137, 138, 139
+};
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int16 yypact[] =
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
{
- -273, 376, -273, -273, -27, -21, -273, -273, -273, -273,
- 157, -273, -273, 11, 11, 11, -5, -3, -273, -273,
- -273, 1019, 1019, -273, 1019, 1065, 821, 116, -273, -20,
- 1, -273, -273, 35, 758, 992, 252, 296, -273, -273,
- -273, -273, 233, 789, 821, -273, 2, -273, -273, -273,
- -273, -273, 63, 54, -273, 69, -273, -273, -273, 789,
- 789, 127, 87, 115, 87, 87, 1019, 131, -273, -273,
- 55, 295, 40, 47, -273, 83, -273, -273, -273, 35,
- -273, 83, -273, 151, -273, -273, 1019, 132, 1019, 1019,
- 1019, 83, -273, -273, -273, 1019, 124, 252, 1019, 1019,
- 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019,
- -273, -273, -273, -273, 152, 1019, 100, 16, 1034, 37,
- -273, -273, -273, 43, 1019, -273, 100, 100, 295, -273,
- -273, -273, 1019, 83, -273, 137, 867, -273, -273, 75,
- -19, -273, 77, -19, 35, -273, 596, -273, -273, 123,
- -273, 141, 175, 1098, 1019, 161, 11, -26, -26, 87,
- 87, 87, 87, -26, -26, 87, 87, 87, 87, -273,
- 1034, -273, -273, -273, -273, 100, 65, 252, -273, -273,
- 1034, -273, 132, -273, 1034, -273, -273, -273, -273, -273,
- 104, -273, 26, 118, 119, 83, 121, -19, -19, -273,
- -273, -19, 1019, -19, 83, -273, -273, -19, -273, -273,
- 1034, -273, 117, 83, 1019, 1034, -273, 83, -273, 112,
- -273, 1019, 1019, -273, 188, 1019, 1019, 710, 900, -273,
- -273, -273, -19, 1034, -273, -273, -273, 642, 596, 83,
- -273, -273, 1034, -273, -273, -273, 295, -19, -21, 126,
- 295, 295, 169, -13, -273, 117, -273, 821, 186, -273,
- -273, -273, 83, -273, -273, 13, -273, -273, -273, 83,
- 83, 139, 132, 83, 55, -273, -273, 710, -273, -273,
- 1, 710, 1019, 100, 743, 137, 1019, 192, -273, -273,
- 295, 83, 286, 83, 992, 83, 44, 83, 710, 83,
- 946, 710, -273, 247, 154, -273, 156, -273, -273, 946,
- 100, -273, -273, -273, 226, 228, -273, 154, -273, 83,
- -273, 100, 83, -273, -273, 83, -273, 83, 710, -273,
- 448, 710, -273, 522, -273
+ 0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 4, 4, 1, 2, 1, 1, 2, 1, 0, 1,
+ 4, 1, 1, 1, 1, 5, 1, 1, 1, 2,
+ 1, 1, 6, 0, 3, 1, 1, 0, 2, 2,
+ 1, 2, 2, 3, 1, 9, 6, 8, 8, 12,
+ 11, 1, 2, 2, 2, 2, 3, 0, 4, 2,
+ 0, 4, 0, 4, 4, 1, 0, 1, 0, 2,
+ 2, 5, 4, 1, 2, 2, 1, 1, 1, 1,
+ 1, 3, 0, 0, 3, 6, 9, 1, 2, 0,
+ 1, 0, 2, 0, 1, 1, 3, 1, 2, 3,
+ 0, 1, 0, 1, 1, 3, 1, 2, 3, 3,
+ 3, 3, 3, 3, 3, 3, 5, 1, 1, 1,
+ 2, 1, 1, 1, 1, 1, 1, 2, 1, 3,
+ 3, 3, 3, 3, 3, 3, 2, 2, 5, 4,
+ 3, 3, 3, 3, 3, 3, 1, 2, 3, 4,
+ 4, 1, 1, 1, 2, 2, 1, 1, 2, 2,
+ 1, 2, 4, 0, 1, 0, 2, 1, 2, 1,
+ 3, 1, 2, 2, 1, 2, 1, 3, 1, 1,
+ 0, 2, 2, 1, 0, 1, 1, 1, 2
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint8 yydefact[] =
{
2, 0, 1, 6, 0, 174, 156, 157, 21, 22,
@@ -815,19 +902,7 @@ static const yytype_uint8 yydefact[] =
0, 0, 50, 0, 49
};
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
-{
- -273, -273, -273, -273, -273, -273, 208, -273, -273, -273,
- -64, -273, -273, -202, 71, -58, -273, -273, -218, -273,
- -273, -272, -273, -273, -273, -273, -273, -273, -273, -273,
- 50, 76, -273, -273, -273, 19, -54, -23, -1, -273,
- -273, -273, -44, 39, -273, 224, -273, -11, 94, -273,
- -273, -7, -38, -273, -273, -73, -2, -273, -28, -231,
- -46, -273, -25, -57, 85
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 1, 28, 140, 143, 29, 77, 53, 54, 30,
@@ -839,9 +914,63 @@ static const yytype_int16 yydefgoto[] =
137, 239, 213, 319, 136
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -273
+static const yytype_int16 yypact[] =
+{
+ -273, 376, -273, -273, -27, -21, -273, -273, -273, -273,
+ 157, -273, -273, 11, 11, 11, -5, -3, -273, -273,
+ -273, 1019, 1019, -273, 1019, 1065, 821, 116, -273, -20,
+ 1, -273, -273, 35, 758, 992, 252, 296, -273, -273,
+ -273, -273, 233, 789, 821, -273, 2, -273, -273, -273,
+ -273, -273, 63, 54, -273, 69, -273, -273, -273, 789,
+ 789, 127, 87, 115, 87, 87, 1019, 131, -273, -273,
+ 55, 295, 40, 47, -273, 83, -273, -273, -273, 35,
+ -273, 83, -273, 151, -273, -273, 1019, 132, 1019, 1019,
+ 1019, 83, -273, -273, -273, 1019, 124, 252, 1019, 1019,
+ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019,
+ -273, -273, -273, -273, 152, 1019, 100, 16, 1034, 37,
+ -273, -273, -273, 43, 1019, -273, 100, 100, 295, -273,
+ -273, -273, 1019, 83, -273, 137, 867, -273, -273, 75,
+ -19, -273, 77, -19, 35, -273, 596, -273, -273, 123,
+ -273, 141, 175, 1098, 1019, 161, 11, -26, -26, 87,
+ 87, 87, 87, -26, -26, 87, 87, 87, 87, -273,
+ 1034, -273, -273, -273, -273, 100, 65, 252, -273, -273,
+ 1034, -273, 132, -273, 1034, -273, -273, -273, -273, -273,
+ 104, -273, 26, 118, 119, 83, 121, -19, -19, -273,
+ -273, -19, 1019, -19, 83, -273, -273, -19, -273, -273,
+ 1034, -273, 117, 83, 1019, 1034, -273, 83, -273, 112,
+ -273, 1019, 1019, -273, 188, 1019, 1019, 710, 900, -273,
+ -273, -273, -19, 1034, -273, -273, -273, 642, 596, 83,
+ -273, -273, 1034, -273, -273, -273, 295, -19, -21, 126,
+ 295, 295, 169, -13, -273, 117, -273, 821, 186, -273,
+ -273, -273, 83, -273, -273, 13, -273, -273, -273, 83,
+ 83, 139, 132, 83, 55, -273, -273, 710, -273, -273,
+ 1, 710, 1019, 100, 743, 137, 1019, 192, -273, -273,
+ 295, 83, 286, 83, 992, 83, 44, 83, 710, 83,
+ 946, 710, -273, 247, 154, -273, 156, -273, -273, 946,
+ 100, -273, -273, -273, 226, 228, -273, 154, -273, 83,
+ -273, 100, 83, -273, -273, 83, -273, 83, 710, -273,
+ 448, 710, -273, 522, -273
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
+{
+ -273, -273, -273, -273, -273, -273, 208, -273, -273, -273,
+ -64, -273, -273, -202, 71, -58, -273, -273, -218, -273,
+ -273, -272, -273, -273, -273, -273, -273, -273, -273, -273,
+ 50, 76, -273, -273, -273, 19, -54, -23, -1, -273,
+ -273, -273, -44, 39, -273, 224, -273, -11, 94, -273,
+ -273, -7, -38, -273, -273, -73, -2, -273, -28, -231,
+ -46, -273, -25, -57, 85
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -104
static const yytype_int16 yytable[] =
{
34, 80, 80, 70, 81, 126, 127, 260, 121, 238,
@@ -962,6 +1091,12 @@ static const yytype_int16 yytable[] =
0, 90, 214, 0, 92, 93
};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-273)))
+
+#define yytable_value_is_error(Yytable_value) \
+ (!!((Yytable_value) == (-104)))
+
static const yytype_int16 yycheck[] =
{
1, 29, 30, 26, 29, 59, 60, 238, 46, 211,
@@ -1082,8 +1217,8 @@ static const yytype_int16 yycheck[] =
-1, 53, 54, -1, 56, 57
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 76, 0, 1, 3, 4, 7, 8, 17, 18,
@@ -1122,64 +1257,30 @@ static const yytype_uint8 yystos[] =
88, 106, 90, 88, 90
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 75, 76, 76, 76, 76, 76, 77, 77, 77,
- 77, 77, 78, 78, 78, 79, 79, 79, 80, 80,
- 80, 80, 80, 80, 80, 81, 82, 82, 82, 82,
- 83, 83, 84, 86, 85, 87, 87, 88, 88, 88,
- 89, 89, 90, 90, 90, 90, 90, 90, 90, 90,
- 90, 90, 91, 91, 91, 91, 91, 92, 91, 91,
- 94, 93, 95, 93, 93, 93, 96, 96, 97, 97,
- 97, 98, 98, 99, 99, 99, 99, 99, 100, 100,
- 101, 101, 102, 103, 102, 104, 104, 105, 105, 106,
- 106, 107, 107, 108, 108, 109, 109, 109, 109, 109,
- 110, 110, 111, 111, 112, 112, 112, 112, 112, 112,
- 113, 113, 113, 113, 113, 113, 113, 113, 114, 114,
- 114, 115, 115, 116, 116, 117, 117, 117, 118, 118,
- 118, 118, 118, 118, 118, 118, 118, 118, 118, 119,
- 119, 119, 119, 119, 119, 119, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 121, 121, 122, 123, 123, 124, 124, 125, 125, 126,
- 127, 128, 128, 129, 130, 130, 131, 131, 132, 132,
- 132, 133, 134, 135, 136, 136, 137, 138, 139
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
- 4, 4, 1, 2, 1, 1, 2, 1, 0, 1,
- 4, 1, 1, 1, 1, 5, 1, 1, 1, 2,
- 1, 1, 6, 0, 3, 1, 1, 0, 2, 2,
- 1, 2, 2, 3, 1, 9, 6, 8, 8, 12,
- 11, 1, 2, 2, 2, 2, 3, 0, 4, 2,
- 0, 4, 0, 4, 4, 1, 0, 1, 0, 2,
- 2, 5, 4, 1, 2, 2, 1, 1, 1, 1,
- 1, 3, 0, 0, 3, 6, 9, 1, 2, 0,
- 1, 0, 2, 0, 1, 1, 3, 1, 2, 3,
- 0, 1, 0, 1, 1, 3, 1, 2, 3, 3,
- 3, 3, 3, 3, 3, 3, 5, 1, 1, 1,
- 2, 1, 1, 1, 1, 1, 1, 2, 1, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 5, 4,
- 3, 3, 3, 3, 3, 3, 1, 2, 3, 4,
- 4, 1, 1, 1, 2, 2, 1, 1, 2, 2,
- 1, 2, 4, 0, 1, 0, 2, 1, 2, 1,
- 3, 1, 2, 2, 1, 2, 1, 3, 1, 1,
- 0, 2, 2, 1, 0, 1, 1, 1, 2
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
+
+#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -1196,15 +1297,27 @@ do \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+ YYERROR; \
+ } \
+while (YYID (0))
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+/* YYLEX -- calling `yylex' with the right arguments. */
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -1214,36 +1327,40 @@ while (0)
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
@@ -1252,8 +1369,14 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
# endif
- YYUSE (yytype);
+ switch (yytype)
+ {
+ default:
+ break;
+ }
}
@@ -1261,11 +1384,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
@@ -1276,8 +1410,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
| TOP (included). |
`------------------------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+#else
+static void
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
+#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -1288,42 +1430,49 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
{
- unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
+ unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1337,7 +1486,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1360,8 +1509,15 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1377,8 +1533,16 @@ yystrlen (const char *yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1408,27 +1572,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1451,11 +1615,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
+ const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1463,6 +1627,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1512,7 +1680,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@@ -1579,17 +1747,31 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
{
YYUSE (yyvaluep);
+
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
}
@@ -1598,8 +1780,18 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
/* The lookahead symbol. */
int yychar;
+
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+
/* Number of syntax errors so far. */
int yynerrs;
@@ -1608,16 +1800,35 @@ int yynerrs;
| yyparse. |
`----------*/
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
+ `yyss': related to states.
+ `yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
@@ -1685,23 +1896,23 @@ yyparse (void)
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1709,22 +1920,22 @@ yyparse (void)
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1733,10 +1944,10 @@ yyparse (void)
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1765,7 +1976,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex ();
+ yychar = YYLEX;
}
if (yychar <= YYEOF)
@@ -1830,7 +2041,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
+ `$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1844,26 +2055,27 @@ yyreduce:
switch (yyn)
{
case 3:
-#line 203 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 210 "awkgram.y"
{
rule = 0;
yyerrok;
}
-#line 1853 "awkgram.c" /* yacc.c:1646 */
break;
case 5:
-#line 209 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 216 "awkgram.y"
{
next_sourcefile();
if (sourcefile == srcfiles)
process_deferred();
}
-#line 1863 "awkgram.c" /* yacc.c:1646 */
break;
case 6:
-#line 215 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 222 "awkgram.y"
{
rule = 0;
/*
@@ -1872,277 +2084,306 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 1876 "awkgram.c" /* yacc.c:1646 */
break;
case 7:
-#line 227 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 234 "awkgram.y"
{
- (void) append_rule((yyvsp[-1]), (yyvsp[0]));
+ (void) append_rule((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
-#line 1884 "awkgram.c" /* yacc.c:1646 */
break;
case 8:
-#line 231 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 238 "awkgram.y"
{
if (rule != Rule) {
msg(_("%s blocks must have an action part"), ruletab[rule]);
errcount++;
- } else if ((yyvsp[-1]) == NULL) {
+ } else if ((yyvsp[(1) - (2)]) == NULL) {
msg(_("each rule must have a pattern or an action part"));
errcount++;
} else /* pattern rule with non-empty pattern */
- (void) append_rule((yyvsp[-1]), NULL);
+ (void) append_rule((yyvsp[(1) - (2)]), NULL);
}
-#line 1899 "awkgram.c" /* yacc.c:1646 */
break;
case 9:
-#line 242 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 249 "awkgram.y"
{
in_function = NULL;
- (void) mk_function((yyvsp[-1]), (yyvsp[0]));
+ (void) mk_function((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
yyerrok;
}
-#line 1909 "awkgram.c" /* yacc.c:1646 */
break;
case 10:
-#line 248 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 255 "awkgram.y"
{
want_source = false;
yyerrok;
}
-#line 1918 "awkgram.c" /* yacc.c:1646 */
break;
case 11:
-#line 253 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 260 "awkgram.y"
{
want_source = false;
yyerrok;
}
-#line 1927 "awkgram.c" /* yacc.c:1646 */
break;
case 12:
-#line 261 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 268 "awkgram.y"
{
- if (include_source((yyvsp[0])) < 0)
+ if (include_source((yyvsp[(1) - (1)])) < 0)
YYABORT;
- efree((yyvsp[0])->lextok);
- bcfree((yyvsp[0]));
+ efree((yyvsp[(1) - (1)])->lextok);
+ bcfree((yyvsp[(1) - (1)]));
(yyval) = NULL;
}
-#line 1939 "awkgram.c" /* yacc.c:1646 */
break;
case 13:
-#line 269 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 276 "awkgram.y"
{ (yyval) = NULL; }
-#line 1945 "awkgram.c" /* yacc.c:1646 */
break;
case 14:
-#line 271 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 278 "awkgram.y"
{ (yyval) = NULL; }
-#line 1951 "awkgram.c" /* yacc.c:1646 */
break;
case 15:
-#line 276 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 283 "awkgram.y"
{
- if (load_library((yyvsp[0])) < 0)
+ if (load_library((yyvsp[(1) - (1)])) < 0)
YYABORT;
- efree((yyvsp[0])->lextok);
- bcfree((yyvsp[0]));
+ efree((yyvsp[(1) - (1)])->lextok);
+ bcfree((yyvsp[(1) - (1)]));
(yyval) = NULL;
}
-#line 1963 "awkgram.c" /* yacc.c:1646 */
break;
case 16:
-#line 284 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 291 "awkgram.y"
{ (yyval) = NULL; }
-#line 1969 "awkgram.c" /* yacc.c:1646 */
break;
case 17:
-#line 286 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 293 "awkgram.y"
{ (yyval) = NULL; }
-#line 1975 "awkgram.c" /* yacc.c:1646 */
break;
case 18:
-#line 291 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = NULL; rule = Rule; }
-#line 1981 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 298 "awkgram.y"
+ { rule = Rule;
+ if (comment != NULL){
+ (yyval) = list_create(comment);
+ comment = NULL;
+ } else
+ (yyval) = NULL;
+ }
break;
case 19:
-#line 293 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); rule = Rule; }
-#line 1987 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 306 "awkgram.y"
+ { rule = Rule;
+ if (comment != NULL){
+ (yyval) = list_prepend((yyvsp[(1) - (1)]), comment);
+ comment = NULL;
+ } else
+ (yyval) = (yyvsp[(1) - (1)]);
+ }
break;
case 20:
-#line 295 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 315 "awkgram.y"
{
INSTRUCTION *tp;
- add_lint((yyvsp[-3]), LINT_assign_in_cond);
- add_lint((yyvsp[0]), LINT_assign_in_cond);
+ add_lint((yyvsp[(1) - (4)]), LINT_assign_in_cond);
+ add_lint((yyvsp[(4) - (4)]), LINT_assign_in_cond);
tp = instruction(Op_no_op);
- list_prepend((yyvsp[-3]), bcalloc(Op_line_range, !!do_pretty_print + 1, 0));
- (yyvsp[-3])->nexti->triggered = false;
- (yyvsp[-3])->nexti->target_jmp = (yyvsp[0])->nexti;
+ list_prepend((yyvsp[(1) - (4)]), bcalloc(Op_line_range, !!do_pretty_print + 1, 0));
+ (yyvsp[(1) - (4)])->nexti->triggered = false;
+ (yyvsp[(1) - (4)])->nexti->target_jmp = (yyvsp[(4) - (4)])->nexti;
- list_append((yyvsp[-3]), instruction(Op_cond_pair));
- (yyvsp[-3])->lasti->line_range = (yyvsp[-3])->nexti;
- (yyvsp[-3])->lasti->target_jmp = tp;
+ list_append((yyvsp[(1) - (4)]), instruction(Op_cond_pair));
+ (yyvsp[(1) - (4)])->lasti->line_range = (yyvsp[(1) - (4)])->nexti;
+ (yyvsp[(1) - (4)])->lasti->target_jmp = tp;
- list_append((yyvsp[0]), instruction(Op_cond_pair));
- (yyvsp[0])->lasti->line_range = (yyvsp[-3])->nexti;
- (yyvsp[0])->lasti->target_jmp = tp;
+ list_append((yyvsp[(4) - (4)]), instruction(Op_cond_pair));
+ (yyvsp[(4) - (4)])->lasti->line_range = (yyvsp[(1) - (4)])->nexti;
+ (yyvsp[(4) - (4)])->lasti->target_jmp = tp;
if (do_pretty_print) {
- ((yyvsp[-3])->nexti + 1)->condpair_left = (yyvsp[-3])->lasti;
- ((yyvsp[-3])->nexti + 1)->condpair_right = (yyvsp[0])->lasti;
+ ((yyvsp[(1) - (4)])->nexti + 1)->condpair_left = (yyvsp[(1) - (4)])->lasti;
+ ((yyvsp[(1) - (4)])->nexti + 1)->condpair_right = (yyvsp[(4) - (4)])->lasti;
}
- (yyval) = list_append(list_merge((yyvsp[-3]), (yyvsp[0])), tp);
+ (yyval) = list_append(list_merge((yyvsp[(1) - (4)]), (yyvsp[(4) - (4)])), tp);
rule = Rule;
}
-#line 2017 "awkgram.c" /* yacc.c:1646 */
break;
case 21:
-#line 321 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 341 "awkgram.y"
{
static int begin_seen = 0;
+ func_first = 0;
+ INSTRUCTION *ip;
if (do_lint_old && ++begin_seen == 2)
- warning_ln((yyvsp[0])->source_line,
+ warning_ln((yyvsp[(1) - (1)])->source_line,
_("old awk does not support multiple `BEGIN' or `END' rules"));
- (yyvsp[0])->in_rule = rule = BEGIN;
- (yyvsp[0])->source_file = source;
- (yyval) = (yyvsp[0]);
+ (yyvsp[(1) - (1)])->in_rule = rule = BEGIN;
+ (yyvsp[(1) - (1)])->source_file = source;
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2032 "awkgram.c" /* yacc.c:1646 */
break;
case 22:
-#line 332 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 354 "awkgram.y"
{
static int end_seen = 0;
+ func_first = 0;
if (do_lint_old && ++end_seen == 2)
- warning_ln((yyvsp[0])->source_line,
+ warning_ln((yyvsp[(1) - (1)])->source_line,
_("old awk does not support multiple `BEGIN' or `END' rules"));
- (yyvsp[0])->in_rule = rule = END;
- (yyvsp[0])->source_file = source;
- (yyval) = (yyvsp[0]);
+ (yyvsp[(1) - (1)])->in_rule = rule = END;
+ (yyvsp[(1) - (1)])->source_file = source;
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2047 "awkgram.c" /* yacc.c:1646 */
break;
case 23:
-#line 343 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 366 "awkgram.y"
{
- (yyvsp[0])->in_rule = rule = BEGINFILE;
- (yyvsp[0])->source_file = source;
- (yyval) = (yyvsp[0]);
+ func_first = 0;
+ (yyvsp[(1) - (1)])->in_rule = rule = BEGINFILE;
+ (yyvsp[(1) - (1)])->source_file = source;
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2057 "awkgram.c" /* yacc.c:1646 */
break;
case 24:
-#line 349 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 373 "awkgram.y"
{
- (yyvsp[0])->in_rule = rule = ENDFILE;
- (yyvsp[0])->source_file = source;
- (yyval) = (yyvsp[0]);
+ func_first = 0;
+ (yyvsp[(1) - (1)])->in_rule = rule = ENDFILE;
+ (yyvsp[(1) - (1)])->source_file = source;
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2067 "awkgram.c" /* yacc.c:1646 */
break;
case 25:
-#line 358 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 383 "awkgram.y"
{
- if ((yyvsp[-3]) == NULL)
- (yyval) = list_create(instruction(Op_no_op));
+ INSTRUCTION *ip;
+ if ((yyvsp[(2) - (5)]) == NULL)
+ ip = list_create(instruction(Op_no_op));
else
- (yyval) = (yyvsp[-3]);
+ ip = (yyvsp[(2) - (5)]);
+ (yyval) = ip;
}
-#line 2078 "awkgram.c" /* yacc.c:1646 */
break;
case 26:
-#line 368 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2084 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 395 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 27:
-#line 370 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2090 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 397 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 28:
-#line 372 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 399 "awkgram.y"
{
yyerror(_("`%s' is a built-in function, it cannot be redefined"),
tokstart);
YYABORT;
}
-#line 2100 "awkgram.c" /* yacc.c:1646 */
break;
case 29:
-#line 378 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2106 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 405 "awkgram.y"
+ { (yyval) = (yyvsp[(2) - (2)]); }
break;
case 32:
-#line 388 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 415 "awkgram.y"
{
- (yyvsp[-5])->source_file = source;
- if (install_function((yyvsp[-4])->lextok, (yyvsp[-5]), (yyvsp[-2])) < 0)
+/* treat any comments between BOF and the first function definition (with no intervening BEGIN etc block) as program comments
+ Special kludge: iff there are more than one such comments, treat the last as a function comment. */
+ if (comment != NULL && func_first && strstr(comment->memory->stptr, "\n\n") != NULL)
+ split_comment();
+ /* save any other pre-function comment as function comment */
+ if (comment != NULL){
+ commentf = comment;
+ comment = NULL;
+ }
+ func_first = 0;
+ (yyvsp[(1) - (6)])->source_file = source;
+ if (install_function((yyvsp[(2) - (6)])->lextok, (yyvsp[(1) - (6)]), (yyvsp[(4) - (6)])) < 0)
YYABORT;
- in_function = (yyvsp[-4])->lextok;
- (yyvsp[-4])->lextok = NULL;
- bcfree((yyvsp[-4]));
+ in_function = (yyvsp[(2) - (6)])->lextok;
+ (yyvsp[(2) - (6)])->lextok = NULL;
+ bcfree((yyvsp[(2) - (6)]));
/* $4 already free'd in install_function */
- (yyval) = (yyvsp[-5]);
+ (yyval) = (yyvsp[(1) - (6)]);
}
-#line 2121 "awkgram.c" /* yacc.c:1646 */
break;
case 33:
-#line 406 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 443 "awkgram.y"
{ want_regexp = true; }
-#line 2127 "awkgram.c" /* yacc.c:1646 */
break;
case 34:
-#line 408 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 445 "awkgram.y"
{
NODE *n, *exp;
char *re;
size_t len;
- re = (yyvsp[0])->lextok;
- (yyvsp[0])->lextok = NULL;
+ re = (yyvsp[(3) - (3)])->lextok;
+ (yyvsp[(3) - (3)])->lextok = NULL;
len = strlen(re);
if (do_lint) {
if (len == 0)
- lintwarn_ln((yyvsp[0])->source_line,
+ lintwarn_ln((yyvsp[(3) - (3)])->source_line,
_("regexp constant `//' looks like a C++ comment, but is not"));
else if (re[0] == '*' && re[len-1] == '*')
/* possible C comment */
- lintwarn_ln((yyvsp[0])->source_line,
+ lintwarn_ln((yyvsp[(3) - (3)])->source_line,
_("regexp constant `/%s/' looks like a C comment, but is not"), re);
}
@@ -2152,73 +2393,93 @@ yyreduce:
unref(exp);
YYABORT;
}
- (yyval) = (yyvsp[0]);
+ (yyval) = (yyvsp[(3) - (3)]);
(yyval)->opcode = Op_match_rec;
(yyval)->memory = n;
}
-#line 2160 "awkgram.c" /* yacc.c:1646 */
break;
case 35:
-#line 440 "awkgram.y" /* yacc.c:1646 */
- { bcfree((yyvsp[0])); }
-#line 2166 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 477 "awkgram.y"
+ { bcfree((yyvsp[(1) - (1)])); }
break;
case 37:
-#line 446 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2172 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 483 "awkgram.y"
+ {
+ if (comment != NULL){
+ (yyval) = list_create(comment);
+ comment = NULL;
+ } else (yyval) = NULL;
+ }
break;
case 38:
-#line 448 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 490 "awkgram.y"
{
- if ((yyvsp[0]) == NULL)
- (yyval) = (yyvsp[-1]);
- else {
- add_lint((yyvsp[0]), LINT_no_effect);
- if ((yyvsp[-1]) == NULL)
- (yyval) = (yyvsp[0]);
- else
- (yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
+ if ((yyvsp[(2) - (2)]) == NULL) {
+ if (comment == NULL)
+ (yyval) = (yyvsp[(1) - (2)]);
+ else {
+ (yyval) = list_append((yyvsp[(1) - (2)]), comment);
+ comment = NULL;
+ }
+ } else {
+ add_lint((yyvsp[(2) - (2)]), LINT_no_effect);
+ if ((yyvsp[(1) - (2)]) == NULL) {
+ if (comment == NULL)
+ (yyval) = (yyvsp[(2) - (2)]);
+ else {
+ (yyval) = list_append((yyvsp[(2) - (2)]), comment);
+ comment = NULL;
+ }
+ } else {
+ if (comment != NULL){
+ list_append((yyvsp[(2) - (2)]), comment);
+ comment = NULL;
+ }
+ (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
+ }
}
- yyerrok;
+ yyerrok;
}
-#line 2189 "awkgram.c" /* yacc.c:1646 */
break;
case 39:
-#line 461 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 518 "awkgram.y"
{ (yyval) = NULL; }
-#line 2195 "awkgram.c" /* yacc.c:1646 */
break;
case 42:
-#line 471 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 528 "awkgram.y"
{ (yyval) = NULL; }
-#line 2201 "awkgram.c" /* yacc.c:1646 */
break;
case 43:
-#line 473 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 2207 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 530 "awkgram.y"
+ { (yyval) = (yyvsp[(2) - (3)]); }
break;
case 44:
-#line 475 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 532 "awkgram.y"
{
if (do_pretty_print)
- (yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
+ (yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count));
else
- (yyval) = (yyvsp[0]);
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2218 "awkgram.c" /* yacc.c:1646 */
break;
case 45:
-#line 482 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 539 "awkgram.y"
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2233,9 +2494,9 @@ yyreduce:
dflt = instruction(Op_jmp);
dflt->target_jmp = tbreak; /* if no case match and no explicit default */
- if ((yyvsp[-2]) != NULL) {
- curr = (yyvsp[-2])->nexti;
- bcfree((yyvsp[-2])); /* Op_list */
+ if ((yyvsp[(7) - (9)]) != NULL) {
+ curr = (yyvsp[(7) - (9)])->nexti;
+ bcfree((yyvsp[(7) - (9)])); /* Op_list */
} /* else
curr = NULL; */
@@ -2291,13 +2552,13 @@ yyreduce:
if (case_values != NULL)
efree(case_values);
- ip = (yyvsp[-6]);
+ ip = (yyvsp[(3) - (9)]);
if (do_pretty_print) {
- (void) list_prepend(ip, (yyvsp[-8]));
+ (void) list_prepend(ip, (yyvsp[(1) - (9)]));
(void) list_prepend(ip, instruction(Op_exec_count));
- (yyvsp[-8])->target_break = tbreak;
- ((yyvsp[-8]) + 1)->switch_start = cexp->nexti;
- ((yyvsp[-8]) + 1)->switch_end = cexp->lasti;
+ (yyvsp[(1) - (9)])->target_break = tbreak;
+ ((yyvsp[(1) - (9)]) + 1)->switch_start = cexp->nexti;
+ ((yyvsp[(1) - (9)]) + 1)->switch_end = cexp->lasti;
}/* else
$1 is NULL */
@@ -2308,11 +2569,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2312 "awkgram.c" /* yacc.c:1646 */
break;
case 46:
-#line 572 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 629 "awkgram.y"
{
/*
* -----------------
@@ -2330,22 +2591,22 @@ yyreduce:
INSTRUCTION *ip, *tbreak, *tcont;
tbreak = instruction(Op_no_op);
- add_lint((yyvsp[-3]), LINT_assign_in_cond);
- tcont = (yyvsp[-3])->nexti;
- ip = list_append((yyvsp[-3]), instruction(Op_jmp_false));
+ add_lint((yyvsp[(3) - (6)]), LINT_assign_in_cond);
+ tcont = (yyvsp[(3) - (6)])->nexti;
+ ip = list_append((yyvsp[(3) - (6)]), instruction(Op_jmp_false));
ip->lasti->target_jmp = tbreak;
if (do_pretty_print) {
(void) list_append(ip, instruction(Op_exec_count));
- (yyvsp[-5])->target_break = tbreak;
- (yyvsp[-5])->target_continue = tcont;
- ((yyvsp[-5]) + 1)->while_body = ip->lasti;
- (void) list_prepend(ip, (yyvsp[-5]));
+ (yyvsp[(1) - (6)])->target_break = tbreak;
+ (yyvsp[(1) - (6)])->target_continue = tcont;
+ ((yyvsp[(1) - (6)]) + 1)->while_body = ip->lasti;
+ (void) list_prepend(ip, (yyvsp[(1) - (6)]));
}/* else
$1 is NULL */
- if ((yyvsp[0]) != NULL)
- (void) list_merge(ip, (yyvsp[0]));
+ if ((yyvsp[(6) - (6)]) != NULL)
+ (void) list_merge(ip, (yyvsp[(6) - (6)]));
(void) list_append(ip, instruction(Op_jmp));
ip->lasti->target_jmp = tcont;
(yyval) = list_append(ip, tbreak);
@@ -2354,11 +2615,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2358 "awkgram.c" /* yacc.c:1646 */
break;
case 47:
-#line 614 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 671 "awkgram.y"
{
/*
* -----------------
@@ -2375,12 +2636,12 @@ yyreduce:
INSTRUCTION *ip, *tbreak, *tcont;
tbreak = instruction(Op_no_op);
- tcont = (yyvsp[-2])->nexti;
- add_lint((yyvsp[-2]), LINT_assign_in_cond);
- if ((yyvsp[-5]) != NULL)
- ip = list_merge((yyvsp[-5]), (yyvsp[-2]));
+ tcont = (yyvsp[(6) - (8)])->nexti;
+ add_lint((yyvsp[(6) - (8)]), LINT_assign_in_cond);
+ if ((yyvsp[(3) - (8)]) != NULL)
+ ip = list_merge((yyvsp[(3) - (8)]), (yyvsp[(6) - (8)]));
else
- ip = list_prepend((yyvsp[-2]), instruction(Op_no_op));
+ ip = list_prepend((yyvsp[(6) - (8)]), instruction(Op_no_op));
if (do_pretty_print)
(void) list_prepend(ip, instruction(Op_exec_count));
(void) list_append(ip, instruction(Op_jmp_true));
@@ -2392,29 +2653,29 @@ yyreduce:
fix_break_continue(ip, tbreak, tcont);
if (do_pretty_print) {
- (yyvsp[-7])->target_break = tbreak;
- (yyvsp[-7])->target_continue = tcont;
- ((yyvsp[-7]) + 1)->doloop_cond = tcont;
- (yyval) = list_prepend(ip, (yyvsp[-7]));
- bcfree((yyvsp[-4]));
+ (yyvsp[(1) - (8)])->target_break = tbreak;
+ (yyvsp[(1) - (8)])->target_continue = tcont;
+ ((yyvsp[(1) - (8)]) + 1)->doloop_cond = tcont;
+ (yyval) = list_prepend(ip, (yyvsp[(1) - (8)]));
+ bcfree((yyvsp[(4) - (8)]));
} /* else
$1 and $4 are NULLs */
}
-#line 2404 "awkgram.c" /* yacc.c:1646 */
break;
case 48:
-#line 656 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 713 "awkgram.y"
{
INSTRUCTION *ip;
- char *var_name = (yyvsp[-5])->lextok;
-
- if ((yyvsp[0]) != NULL
- && (yyvsp[0])->lasti->opcode == Op_K_delete
- && (yyvsp[0])->lasti->expr_count == 1
- && (yyvsp[0])->nexti->opcode == Op_push
- && ((yyvsp[0])->nexti->memory->type != Node_var || !((yyvsp[0])->nexti->memory->var_update))
- && strcmp((yyvsp[0])->nexti->memory->vname, var_name) == 0
+ char *var_name = (yyvsp[(3) - (8)])->lextok;
+
+ if ((yyvsp[(8) - (8)]) != NULL
+ && (yyvsp[(8) - (8)])->lasti->opcode == Op_K_delete
+ && (yyvsp[(8) - (8)])->lasti->expr_count == 1
+ && (yyvsp[(8) - (8)])->nexti->opcode == Op_push
+ && ((yyvsp[(8) - (8)])->nexti->memory->type != Node_var || !((yyvsp[(8) - (8)])->nexti->memory->var_update))
+ && strcmp((yyvsp[(8) - (8)])->nexti->memory->vname, var_name) == 0
) {
/* Efficiency hack. Recognize the special case of
@@ -2431,25 +2692,25 @@ yyreduce:
*/
NODE *arr = NULL;
- ip = (yyvsp[0])->nexti->nexti;
- if ((yyvsp[-3])->nexti->opcode == Op_push && (yyvsp[-3])->lasti == (yyvsp[-3])->nexti)
- arr = (yyvsp[-3])->nexti->memory;
+ ip = (yyvsp[(8) - (8)])->nexti->nexti;
+ if ((yyvsp[(5) - (8)])->nexti->opcode == Op_push && (yyvsp[(5) - (8)])->lasti == (yyvsp[(5) - (8)])->nexti)
+ arr = (yyvsp[(5) - (8)])->nexti->memory;
if (arr != NULL
&& ip->opcode == Op_no_op
&& ip->nexti->opcode == Op_push_array
&& strcmp(ip->nexti->memory->vname, arr->vname) == 0
- && ip->nexti->nexti == (yyvsp[0])->lasti
+ && ip->nexti->nexti == (yyvsp[(8) - (8)])->lasti
) {
- (void) make_assignable((yyvsp[0])->nexti);
- (yyvsp[0])->lasti->opcode = Op_K_delete_loop;
- (yyvsp[0])->lasti->expr_count = 0;
- if ((yyvsp[-7]) != NULL)
- bcfree((yyvsp[-7]));
+ (void) make_assignable((yyvsp[(8) - (8)])->nexti);
+ (yyvsp[(8) - (8)])->lasti->opcode = Op_K_delete_loop;
+ (yyvsp[(8) - (8)])->lasti->expr_count = 0;
+ if ((yyvsp[(1) - (8)]) != NULL)
+ bcfree((yyvsp[(1) - (8)]));
efree(var_name);
- bcfree((yyvsp[-5]));
- bcfree((yyvsp[-4]));
- bcfree((yyvsp[-3]));
- (yyval) = (yyvsp[0]);
+ bcfree((yyvsp[(3) - (8)]));
+ bcfree((yyvsp[(4) - (8)]));
+ bcfree((yyvsp[(5) - (8)]));
+ (yyval) = (yyvsp[(8) - (8)]);
} else
goto regular_loop;
} else {
@@ -2466,50 +2727,50 @@ yyreduce:
* ib:[Op_arrayfor_final ]
*/
regular_loop:
- ip = (yyvsp[-3]);
+ ip = (yyvsp[(5) - (8)]);
ip->nexti->opcode = Op_push_array;
tbreak = instruction(Op_arrayfor_final);
- (yyvsp[-4])->opcode = Op_arrayfor_incr;
- (yyvsp[-4])->array_var = variable((yyvsp[-5])->source_line, var_name, Node_var);
- (yyvsp[-4])->target_jmp = tbreak;
- tcont = (yyvsp[-4]);
- (yyvsp[-5])->opcode = Op_arrayfor_init;
- (yyvsp[-5])->target_jmp = tbreak;
- (void) list_append(ip, (yyvsp[-5]));
+ (yyvsp[(4) - (8)])->opcode = Op_arrayfor_incr;
+ (yyvsp[(4) - (8)])->array_var = variable((yyvsp[(3) - (8)])->source_line, var_name, Node_var);
+ (yyvsp[(4) - (8)])->target_jmp = tbreak;
+ tcont = (yyvsp[(4) - (8)]);
+ (yyvsp[(3) - (8)])->opcode = Op_arrayfor_init;
+ (yyvsp[(3) - (8)])->target_jmp = tbreak;
+ (void) list_append(ip, (yyvsp[(3) - (8)]));
if (do_pretty_print) {
- (yyvsp[-7])->opcode = Op_K_arrayfor;
- (yyvsp[-7])->target_continue = tcont;
- (yyvsp[-7])->target_break = tbreak;
- (void) list_append(ip, (yyvsp[-7]));
+ (yyvsp[(1) - (8)])->opcode = Op_K_arrayfor;
+ (yyvsp[(1) - (8)])->target_continue = tcont;
+ (yyvsp[(1) - (8)])->target_break = tbreak;
+ (void) list_append(ip, (yyvsp[(1) - (8)]));
} /* else
$1 is NULL */
/* add update_FOO instruction if necessary */
- if ((yyvsp[-4])->array_var->type == Node_var && (yyvsp[-4])->array_var->var_update) {
+ if ((yyvsp[(4) - (8)])->array_var->type == Node_var && (yyvsp[(4) - (8)])->array_var->var_update) {
(void) list_append(ip, instruction(Op_var_update));
- ip->lasti->update_var = (yyvsp[-4])->array_var->var_update;
+ ip->lasti->update_var = (yyvsp[(4) - (8)])->array_var->var_update;
}
- (void) list_append(ip, (yyvsp[-4]));
+ (void) list_append(ip, (yyvsp[(4) - (8)]));
/* add set_FOO instruction if necessary */
- if ((yyvsp[-4])->array_var->type == Node_var && (yyvsp[-4])->array_var->var_assign) {
+ if ((yyvsp[(4) - (8)])->array_var->type == Node_var && (yyvsp[(4) - (8)])->array_var->var_assign) {
(void) list_append(ip, instruction(Op_var_assign));
- ip->lasti->assign_var = (yyvsp[-4])->array_var->var_assign;
+ ip->lasti->assign_var = (yyvsp[(4) - (8)])->array_var->var_assign;
}
if (do_pretty_print) {
(void) list_append(ip, instruction(Op_exec_count));
- ((yyvsp[-7]) + 1)->forloop_cond = (yyvsp[-4]);
- ((yyvsp[-7]) + 1)->forloop_body = ip->lasti;
+ ((yyvsp[(1) - (8)]) + 1)->forloop_cond = (yyvsp[(4) - (8)]);
+ ((yyvsp[(1) - (8)]) + 1)->forloop_body = ip->lasti;
}
- if ((yyvsp[0]) != NULL)
- (void) list_merge(ip, (yyvsp[0]));
+ if ((yyvsp[(8) - (8)]) != NULL)
+ (void) list_merge(ip, (yyvsp[(8) - (8)]));
(void) list_append(ip, instruction(Op_jmp));
- ip->lasti->target_jmp = (yyvsp[-4]);
+ ip->lasti->target_jmp = (yyvsp[(4) - (8)]);
(yyval) = list_append(ip, tbreak);
fix_break_continue(ip, tbreak, tcont);
}
@@ -2517,157 +2778,157 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2521 "awkgram.c" /* yacc.c:1646 */
break;
case 49:
-#line 769 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 826 "awkgram.y"
{
- (yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]), (yyvsp[-3]), (yyvsp[0]));
+ (yyval) = mk_for_loop((yyvsp[(1) - (12)]), (yyvsp[(3) - (12)]), (yyvsp[(6) - (12)]), (yyvsp[(9) - (12)]), (yyvsp[(12) - (12)]));
break_allowed--;
continue_allowed--;
}
-#line 2532 "awkgram.c" /* yacc.c:1646 */
break;
case 50:
-#line 776 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 833 "awkgram.y"
{
- (yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION *) NULL, (yyvsp[-3]), (yyvsp[0]));
+ (yyval) = mk_for_loop((yyvsp[(1) - (11)]), (yyvsp[(3) - (11)]), (INSTRUCTION *) NULL, (yyvsp[(8) - (11)]), (yyvsp[(11) - (11)]));
break_allowed--;
continue_allowed--;
}
-#line 2543 "awkgram.c" /* yacc.c:1646 */
break;
case 51:
-#line 783 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 840 "awkgram.y"
{
if (do_pretty_print)
- (yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
+ (yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count));
else
- (yyval) = (yyvsp[0]);
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2554 "awkgram.c" /* yacc.c:1646 */
break;
case 52:
-#line 793 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 850 "awkgram.y"
{
if (! break_allowed)
- error_ln((yyvsp[-1])->source_line,
+ error_ln((yyvsp[(1) - (2)])->source_line,
_("`break' is not allowed outside a loop or switch"));
- (yyvsp[-1])->target_jmp = NULL;
- (yyval) = list_create((yyvsp[-1]));
+ (yyvsp[(1) - (2)])->target_jmp = NULL;
+ (yyval) = list_create((yyvsp[(1) - (2)]));
}
-#line 2567 "awkgram.c" /* yacc.c:1646 */
break;
case 53:
-#line 802 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 859 "awkgram.y"
{
if (! continue_allowed)
- error_ln((yyvsp[-1])->source_line,
+ error_ln((yyvsp[(1) - (2)])->source_line,
_("`continue' is not allowed outside a loop"));
- (yyvsp[-1])->target_jmp = NULL;
- (yyval) = list_create((yyvsp[-1]));
+ (yyvsp[(1) - (2)])->target_jmp = NULL;
+ (yyval) = list_create((yyvsp[(1) - (2)]));
}
-#line 2580 "awkgram.c" /* yacc.c:1646 */
break;
case 54:
-#line 811 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 868 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
- error_ln((yyvsp[-1])->source_line,
+ error_ln((yyvsp[(1) - (2)])->source_line,
_("`next' used in %s action"), ruletab[rule]);
- (yyvsp[-1])->target_jmp = ip_rec;
- (yyval) = list_create((yyvsp[-1]));
+ (yyvsp[(1) - (2)])->target_jmp = ip_rec;
+ (yyval) = list_create((yyvsp[(1) - (2)]));
}
-#line 2593 "awkgram.c" /* yacc.c:1646 */
break;
case 55:
-#line 820 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 877 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
- error_ln((yyvsp[-1])->source_line,
+ error_ln((yyvsp[(1) - (2)])->source_line,
_("`nextfile' used in %s action"), ruletab[rule]);
- (yyvsp[-1])->target_newfile = ip_newfile;
- (yyvsp[-1])->target_endfile = ip_endfile;
- (yyval) = list_create((yyvsp[-1]));
+ (yyvsp[(1) - (2)])->target_newfile = ip_newfile;
+ (yyvsp[(1) - (2)])->target_endfile = ip_endfile;
+ (yyval) = list_create((yyvsp[(1) - (2)]));
}
-#line 2608 "awkgram.c" /* yacc.c:1646 */
break;
case 56:
-#line 831 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 888 "awkgram.y"
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
*/
- (yyvsp[-2])->target_end = ip_end; /* first instruction in end_block */
- (yyvsp[-2])->target_atexit = ip_atexit; /* cleanup and go home */
+ (yyvsp[(1) - (3)])->target_end = ip_end; /* first instruction in end_block */
+ (yyvsp[(1) - (3)])->target_atexit = ip_atexit; /* cleanup and go home */
- if ((yyvsp[-1]) == NULL) {
- (yyval) = list_create((yyvsp[-2]));
+ if ((yyvsp[(2) - (3)]) == NULL) {
+ (yyval) = list_create((yyvsp[(1) - (3)]));
(void) list_prepend((yyval), instruction(Op_push_i));
(yyval)->nexti->memory = dupnode(Nnull_string);
} else
- (yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
+ (yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)]));
}
-#line 2627 "awkgram.c" /* yacc.c:1646 */
break;
case 57:
-#line 846 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 903 "awkgram.y"
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2636 "awkgram.c" /* yacc.c:1646 */
break;
case 58:
-#line 849 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 906 "awkgram.y"
{
- if ((yyvsp[-1]) == NULL) {
- (yyval) = list_create((yyvsp[-3]));
+ if ((yyvsp[(3) - (4)]) == NULL) {
+ (yyval) = list_create((yyvsp[(1) - (4)]));
(void) list_prepend((yyval), instruction(Op_push_i));
(yyval)->nexti->memory = dupnode(Nnull_string);
} else {
if (do_optimize
- && (yyvsp[-1])->lasti->opcode == Op_func_call
- && strcmp((yyvsp[-1])->lasti->func_name, in_function) == 0
+ && (yyvsp[(3) - (4)])->lasti->opcode == Op_func_call
+ && strcmp((yyvsp[(3) - (4)])->lasti->func_name, in_function) == 0
) {
/* Do tail recursion optimization. Tail
* call without a return value is recognized
* in mk_function().
*/
- ((yyvsp[-1])->lasti + 1)->tail_call = true;
+ ((yyvsp[(3) - (4)])->lasti + 1)->tail_call = true;
}
- (yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
+ (yyval) = list_append((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
}
}
-#line 2661 "awkgram.c" /* yacc.c:1646 */
break;
case 60:
-#line 881 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 938 "awkgram.y"
{ in_print = true; in_parens = 0; }
-#line 2667 "awkgram.c" /* yacc.c:1646 */
break;
case 61:
-#line 882 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 939 "awkgram.y"
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -2675,12 +2936,12 @@ regular_loop:
* which is faster for these two cases.
*/
- if ((yyvsp[-3])->opcode == Op_K_print &&
- ((yyvsp[-1]) == NULL
- || ((yyvsp[-1])->lasti->opcode == Op_field_spec
- && (yyvsp[-1])->nexti->nexti->nexti == (yyvsp[-1])->lasti
- && (yyvsp[-1])->nexti->nexti->opcode == Op_push_i
- && (yyvsp[-1])->nexti->nexti->memory->type == Node_val)
+ if ((yyvsp[(1) - (4)])->opcode == Op_K_print &&
+ ((yyvsp[(3) - (4)]) == NULL
+ || ((yyvsp[(3) - (4)])->lasti->opcode == Op_field_spec
+ && (yyvsp[(3) - (4)])->nexti->nexti->nexti == (yyvsp[(3) - (4)])->lasti
+ && (yyvsp[(3) - (4)])->nexti->nexti->opcode == Op_push_i
+ && (yyvsp[(3) - (4)])->nexti->nexti->memory->type == Node_val)
)
) {
static bool warned = false;
@@ -2693,37 +2954,37 @@ regular_loop:
* [Op_K_print_rec | NULL | redir_type | expr_count]
*/
- if ((yyvsp[-1]) != NULL) {
- NODE *n = (yyvsp[-1])->nexti->nexti->memory;
+ if ((yyvsp[(3) - (4)]) != NULL) {
+ NODE *n = (yyvsp[(3) - (4)])->nexti->nexti->memory;
if (! iszero(n))
goto regular_print;
- bcfree((yyvsp[-1])->lasti); /* Op_field_spec */
+ bcfree((yyvsp[(3) - (4)])->lasti); /* Op_field_spec */
unref(n); /* Node_val */
- bcfree((yyvsp[-1])->nexti->nexti); /* Op_push_i */
- bcfree((yyvsp[-1])->nexti); /* Op_list */
- bcfree((yyvsp[-1])); /* Op_list */
+ bcfree((yyvsp[(3) - (4)])->nexti->nexti); /* Op_push_i */
+ bcfree((yyvsp[(3) - (4)])->nexti); /* Op_list */
+ bcfree((yyvsp[(3) - (4)])); /* Op_list */
} else {
if (do_lint && (rule == BEGIN || rule == END) && ! warned) {
warned = true;
- lintwarn_ln((yyvsp[-3])->source_line,
+ lintwarn_ln((yyvsp[(1) - (4)])->source_line,
_("plain `print' in BEGIN or END rule should probably be `print \"\"'"));
}
}
- (yyvsp[-3])->expr_count = 0;
- (yyvsp[-3])->opcode = Op_K_print_rec;
- if ((yyvsp[0]) == NULL) { /* no redircetion */
- (yyvsp[-3])->redir_type = redirect_none;
- (yyval) = list_create((yyvsp[-3]));
+ (yyvsp[(1) - (4)])->expr_count = 0;
+ (yyvsp[(1) - (4)])->opcode = Op_K_print_rec;
+ if ((yyvsp[(4) - (4)]) == NULL) { /* no redircetion */
+ (yyvsp[(1) - (4)])->redir_type = redirect_none;
+ (yyval) = list_create((yyvsp[(1) - (4)]));
} else {
INSTRUCTION *ip;
- ip = (yyvsp[0])->nexti;
- (yyvsp[-3])->redir_type = ip->redir_type;
- (yyvsp[0])->nexti = ip->nexti;
+ ip = (yyvsp[(4) - (4)])->nexti;
+ (yyvsp[(1) - (4)])->redir_type = ip->redir_type;
+ (yyvsp[(4) - (4)])->nexti = ip->nexti;
bcfree(ip);
- (yyval) = list_append((yyvsp[0]), (yyvsp[-3]));
+ (yyval) = list_append((yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]));
}
} else {
/* -----------------
@@ -2736,59 +2997,59 @@ regular_loop:
*
*/
regular_print:
- if ((yyvsp[0]) == NULL) { /* no redirection */
- if ((yyvsp[-1]) == NULL) { /* printf without arg */
- (yyvsp[-3])->expr_count = 0;
- (yyvsp[-3])->redir_type = redirect_none;
- (yyval) = list_create((yyvsp[-3]));
+ if ((yyvsp[(4) - (4)]) == NULL) { /* no redirection */
+ if ((yyvsp[(3) - (4)]) == NULL) { /* printf without arg */
+ (yyvsp[(1) - (4)])->expr_count = 0;
+ (yyvsp[(1) - (4)])->redir_type = redirect_none;
+ (yyval) = list_create((yyvsp[(1) - (4)]));
} else {
- INSTRUCTION *t = (yyvsp[-1]);
- (yyvsp[-3])->expr_count = count_expressions(&t, false);
- (yyvsp[-3])->redir_type = redirect_none;
- (yyval) = list_append(t, (yyvsp[-3]));
+ INSTRUCTION *t = (yyvsp[(3) - (4)]);
+ (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, false);
+ (yyvsp[(1) - (4)])->redir_type = redirect_none;
+ (yyval) = list_append(t, (yyvsp[(1) - (4)]));
}
} else {
INSTRUCTION *ip;
- ip = (yyvsp[0])->nexti;
- (yyvsp[-3])->redir_type = ip->redir_type;
- (yyvsp[0])->nexti = ip->nexti;
+ ip = (yyvsp[(4) - (4)])->nexti;
+ (yyvsp[(1) - (4)])->redir_type = ip->redir_type;
+ (yyvsp[(4) - (4)])->nexti = ip->nexti;
bcfree(ip);
- if ((yyvsp[-1]) == NULL) {
- (yyvsp[-3])->expr_count = 0;
- (yyval) = list_append((yyvsp[0]), (yyvsp[-3]));
+ if ((yyvsp[(3) - (4)]) == NULL) {
+ (yyvsp[(1) - (4)])->expr_count = 0;
+ (yyval) = list_append((yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]));
} else {
- INSTRUCTION *t = (yyvsp[-1]);
- (yyvsp[-3])->expr_count = count_expressions(&t, false);
- (yyval) = list_append(list_merge((yyvsp[0]), t), (yyvsp[-3]));
+ INSTRUCTION *t = (yyvsp[(3) - (4)]);
+ (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, false);
+ (yyval) = list_append(list_merge((yyvsp[(4) - (4)]), t), (yyvsp[(1) - (4)]));
}
}
}
}
-#line 2768 "awkgram.c" /* yacc.c:1646 */
break;
case 62:
-#line 979 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1036 "awkgram.y"
{ sub_counter = 0; }
-#line 2774 "awkgram.c" /* yacc.c:1646 */
break;
case 63:
-#line 980 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1037 "awkgram.y"
{
- char *arr = (yyvsp[-2])->lextok;
+ char *arr = (yyvsp[(2) - (4)])->lextok;
- (yyvsp[-2])->opcode = Op_push_array;
- (yyvsp[-2])->memory = variable((yyvsp[-2])->source_line, arr, Node_var_new);
+ (yyvsp[(2) - (4)])->opcode = Op_push_array;
+ (yyvsp[(2) - (4)])->memory = variable((yyvsp[(2) - (4)])->source_line, arr, Node_var_new);
if (! do_posix && ! do_traditional) {
- if ((yyvsp[-2])->memory == symbol_table)
+ if ((yyvsp[(2) - (4)])->memory == symbol_table)
fatal(_("`delete' is not allowed with SYMTAB"));
- else if ((yyvsp[-2])->memory == func_table)
+ else if ((yyvsp[(2) - (4)])->memory == func_table)
fatal(_("`delete' is not allowed with FUNCTAB"));
}
- if ((yyvsp[0]) == NULL) {
+ if ((yyvsp[(4) - (4)]) == NULL) {
/*
* As of September 2012, POSIX has added support
* for `delete array'. See:
@@ -2800,525 +3061,525 @@ regular_print:
* Also, since BWK awk supports it, we don't have to
* check do_traditional either.
*/
- (yyvsp[-3])->expr_count = 0;
- (yyval) = list_append(list_create((yyvsp[-2])), (yyvsp[-3]));
+ (yyvsp[(1) - (4)])->expr_count = 0;
+ (yyval) = list_append(list_create((yyvsp[(2) - (4)])), (yyvsp[(1) - (4)]));
} else {
- (yyvsp[-3])->expr_count = sub_counter;
- (yyval) = list_append(list_append((yyvsp[0]), (yyvsp[-2])), (yyvsp[-3]));
+ (yyvsp[(1) - (4)])->expr_count = sub_counter;
+ (yyval) = list_append(list_append((yyvsp[(4) - (4)]), (yyvsp[(2) - (4)])), (yyvsp[(1) - (4)]));
}
}
-#line 2811 "awkgram.c" /* yacc.c:1646 */
break;
case 64:
-#line 1017 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1074 "awkgram.y"
{
static bool warned = false;
- char *arr = (yyvsp[-1])->lextok;
+ char *arr = (yyvsp[(3) - (4)])->lextok;
if (do_lint && ! warned) {
warned = true;
- lintwarn_ln((yyvsp[-3])->source_line,
+ lintwarn_ln((yyvsp[(1) - (4)])->source_line,
_("`delete(array)' is a non-portable tawk extension"));
}
if (do_traditional) {
- error_ln((yyvsp[-3])->source_line,
+ error_ln((yyvsp[(1) - (4)])->source_line,
_("`delete(array)' is a non-portable tawk extension"));
}
- (yyvsp[-1])->memory = variable((yyvsp[-1])->source_line, arr, Node_var_new);
- (yyvsp[-1])->opcode = Op_push_array;
- (yyvsp[-3])->expr_count = 0;
- (yyval) = list_append(list_create((yyvsp[-1])), (yyvsp[-3]));
+ (yyvsp[(3) - (4)])->memory = variable((yyvsp[(3) - (4)])->source_line, arr, Node_var_new);
+ (yyvsp[(3) - (4)])->opcode = Op_push_array;
+ (yyvsp[(1) - (4)])->expr_count = 0;
+ (yyval) = list_append(list_create((yyvsp[(3) - (4)])), (yyvsp[(1) - (4)]));
if (! do_posix && ! do_traditional) {
- if ((yyvsp[-1])->memory == symbol_table)
+ if ((yyvsp[(3) - (4)])->memory == symbol_table)
fatal(_("`delete' is not allowed with SYMTAB"));
- else if ((yyvsp[-1])->memory == func_table)
+ else if ((yyvsp[(3) - (4)])->memory == func_table)
fatal(_("`delete' is not allowed with FUNCTAB"));
}
}
-#line 2841 "awkgram.c" /* yacc.c:1646 */
break;
case 65:
-#line 1043 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = optimize_assignment((yyvsp[0])); }
-#line 2847 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1100 "awkgram.y"
+ { (yyval) = optimize_assignment((yyvsp[(1) - (1)])); }
break;
case 66:
-#line 1048 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1105 "awkgram.y"
{ (yyval) = NULL; }
-#line 2853 "awkgram.c" /* yacc.c:1646 */
break;
case 67:
-#line 1050 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2859 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1107 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 68:
-#line 1055 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1112 "awkgram.y"
{ (yyval) = NULL; }
-#line 2865 "awkgram.c" /* yacc.c:1646 */
break;
case 69:
-#line 1057 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1114 "awkgram.y"
{
- if ((yyvsp[-1]) == NULL)
- (yyval) = list_create((yyvsp[0]));
+ if ((yyvsp[(1) - (2)]) == NULL)
+ (yyval) = list_create((yyvsp[(2) - (2)]));
else
- (yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
+ (yyval) = list_prepend((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
-#line 2876 "awkgram.c" /* yacc.c:1646 */
break;
case 70:
-#line 1064 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1121 "awkgram.y"
{ (yyval) = NULL; }
-#line 2882 "awkgram.c" /* yacc.c:1646 */
break;
case 71:
-#line 1069 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1126 "awkgram.y"
{
- INSTRUCTION *casestmt = (yyvsp[0]);
- if ((yyvsp[0]) == NULL)
+ INSTRUCTION *casestmt = (yyvsp[(5) - (5)]);
+ if ((yyvsp[(5) - (5)]) == NULL)
casestmt = list_create(instruction(Op_no_op));
if (do_pretty_print)
(void) list_prepend(casestmt, instruction(Op_exec_count));
- (yyvsp[-4])->case_exp = (yyvsp[-3]);
- (yyvsp[-4])->case_stmt = casestmt;
- bcfree((yyvsp[-2]));
- (yyval) = (yyvsp[-4]);
+ (yyvsp[(1) - (5)])->case_exp = (yyvsp[(2) - (5)]);
+ (yyvsp[(1) - (5)])->case_stmt = casestmt;
+ bcfree((yyvsp[(3) - (5)]));
+ (yyval) = (yyvsp[(1) - (5)]);
}
-#line 2898 "awkgram.c" /* yacc.c:1646 */
break;
case 72:
-#line 1081 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1138 "awkgram.y"
{
- INSTRUCTION *casestmt = (yyvsp[0]);
- if ((yyvsp[0]) == NULL)
+ INSTRUCTION *casestmt = (yyvsp[(4) - (4)]);
+ if ((yyvsp[(4) - (4)]) == NULL)
casestmt = list_create(instruction(Op_no_op));
if (do_pretty_print)
(void) list_prepend(casestmt, instruction(Op_exec_count));
- bcfree((yyvsp[-2]));
- (yyvsp[-3])->case_stmt = casestmt;
- (yyval) = (yyvsp[-3]);
+ bcfree((yyvsp[(2) - (4)]));
+ (yyvsp[(1) - (4)])->case_stmt = casestmt;
+ (yyval) = (yyvsp[(1) - (4)]);
}
-#line 2913 "awkgram.c" /* yacc.c:1646 */
break;
case 73:
-#line 1095 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2919 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1152 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 74:
-#line 1097 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1154 "awkgram.y"
{
- NODE *n = (yyvsp[0])->memory;
+ NODE *n = (yyvsp[(2) - (2)])->memory;
(void) force_number(n);
negate_num(n);
- bcfree((yyvsp[-1]));
- (yyval) = (yyvsp[0]);
+ bcfree((yyvsp[(1) - (2)]));
+ (yyval) = (yyvsp[(2) - (2)]);
}
-#line 2931 "awkgram.c" /* yacc.c:1646 */
break;
case 75:
-#line 1105 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1162 "awkgram.y"
{
- bcfree((yyvsp[-1]));
- (yyval) = (yyvsp[0]);
+ bcfree((yyvsp[(1) - (2)]));
+ (yyval) = (yyvsp[(2) - (2)]);
}
-#line 2940 "awkgram.c" /* yacc.c:1646 */
break;
case 76:
-#line 1110 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2946 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1167 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 77:
-#line 1112 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1169 "awkgram.y"
{
- (yyvsp[0])->opcode = Op_push_re;
- (yyval) = (yyvsp[0]);
+ (yyvsp[(1) - (1)])->opcode = Op_push_re;
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 2955 "awkgram.c" /* yacc.c:1646 */
break;
case 78:
-#line 1120 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2961 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1177 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 79:
-#line 1122 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2967 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1179 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 81:
-#line 1132 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1189 "awkgram.y"
{
- (yyval) = (yyvsp[-1]);
+ (yyval) = (yyvsp[(2) - (3)]);
}
-#line 2975 "awkgram.c" /* yacc.c:1646 */
break;
case 82:
-#line 1139 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1196 "awkgram.y"
{
in_print = false;
in_parens = 0;
(yyval) = NULL;
}
-#line 2985 "awkgram.c" /* yacc.c:1646 */
break;
case 83:
-#line 1144 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1201 "awkgram.y"
{ in_print = false; in_parens = 0; }
-#line 2991 "awkgram.c" /* yacc.c:1646 */
break;
case 84:
-#line 1145 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1202 "awkgram.y"
{
- if ((yyvsp[-2])->redir_type == redirect_twoway
- && (yyvsp[0])->lasti->opcode == Op_K_getline_redir
- && (yyvsp[0])->lasti->redir_type == redirect_twoway)
+ if ((yyvsp[(1) - (3)])->redir_type == redirect_twoway
+ && (yyvsp[(3) - (3)])->lasti->opcode == Op_K_getline_redir
+ && (yyvsp[(3) - (3)])->lasti->redir_type == redirect_twoway)
yyerror(_("multistage two-way pipelines don't work"));
- (yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
+ (yyval) = list_prepend((yyvsp[(3) - (3)]), (yyvsp[(1) - (3)]));
}
-#line 3003 "awkgram.c" /* yacc.c:1646 */
break;
case 85:
-#line 1156 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1213 "awkgram.y"
{
- (yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]), NULL, NULL);
+ (yyval) = mk_condition((yyvsp[(3) - (6)]), (yyvsp[(1) - (6)]), (yyvsp[(6) - (6)]), NULL, NULL);
}
-#line 3011 "awkgram.c" /* yacc.c:1646 */
break;
case 86:
-#line 1161 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1218 "awkgram.y"
{
- (yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[0]));
+ (yyval) = mk_condition((yyvsp[(3) - (9)]), (yyvsp[(1) - (9)]), (yyvsp[(6) - (9)]), (yyvsp[(7) - (9)]), (yyvsp[(9) - (9)]));
}
-#line 3019 "awkgram.c" /* yacc.c:1646 */
break;
case 91:
-#line 1178 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1235 "awkgram.y"
{ (yyval) = NULL; }
-#line 3025 "awkgram.c" /* yacc.c:1646 */
break;
case 92:
-#line 1180 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1237 "awkgram.y"
{
- bcfree((yyvsp[-1]));
- (yyval) = (yyvsp[0]);
+ bcfree((yyvsp[(1) - (2)]));
+ (yyval) = (yyvsp[(2) - (2)]);
}
-#line 3034 "awkgram.c" /* yacc.c:1646 */
break;
case 93:
-#line 1188 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1245 "awkgram.y"
{ (yyval) = NULL; }
-#line 3040 "awkgram.c" /* yacc.c:1646 */
break;
case 94:
-#line 1190 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]) ; }
-#line 3046 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1247 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]) ; }
break;
case 95:
-#line 1195 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1252 "awkgram.y"
{
- (yyvsp[0])->param_count = 0;
- (yyval) = list_create((yyvsp[0]));
+ (yyvsp[(1) - (1)])->param_count = 0;
+ (yyval) = list_create((yyvsp[(1) - (1)]));
}
-#line 3055 "awkgram.c" /* yacc.c:1646 */
break;
case 96:
-#line 1200 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1257 "awkgram.y"
{
- (yyvsp[0])->param_count = (yyvsp[-2])->lasti->param_count + 1;
- (yyval) = list_append((yyvsp[-2]), (yyvsp[0]));
+ (yyvsp[(3) - (3)])->param_count = (yyvsp[(1) - (3)])->lasti->param_count + 1;
+ (yyval) = list_append((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
yyerrok;
}
-#line 3065 "awkgram.c" /* yacc.c:1646 */
break;
case 97:
-#line 1206 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1263 "awkgram.y"
{ (yyval) = NULL; }
-#line 3071 "awkgram.c" /* yacc.c:1646 */
break;
case 98:
-#line 1208 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 3077 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1265 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (2)]); }
break;
case 99:
-#line 1210 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-2]); }
-#line 3083 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1267 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (3)]); }
break;
case 100:
-#line 1216 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1273 "awkgram.y"
{ (yyval) = NULL; }
-#line 3089 "awkgram.c" /* yacc.c:1646 */
break;
case 101:
-#line 1218 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3095 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1275 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 102:
-#line 1223 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1280 "awkgram.y"
{ (yyval) = NULL; }
-#line 3101 "awkgram.c" /* yacc.c:1646 */
break;
case 103:
-#line 1225 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3107 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1282 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 104:
-#line 1230 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3113 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1287 "awkgram.y"
+ { (yyval) = mk_expression_list(NULL, (yyvsp[(1) - (1)])); }
break;
case 105:
-#line 1232 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1289 "awkgram.y"
{
- (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
+ (yyval) = mk_expression_list((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
yyerrok;
}
-#line 3122 "awkgram.c" /* yacc.c:1646 */
break;
case 106:
-#line 1237 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1294 "awkgram.y"
{ (yyval) = NULL; }
-#line 3128 "awkgram.c" /* yacc.c:1646 */
break;
case 107:
-#line 1239 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1296 "awkgram.y"
{
/*
* Returning the expression list instead of NULL lets
* snode get a list of arguments that it can count.
*/
- (yyval) = (yyvsp[-1]);
+ (yyval) = (yyvsp[(1) - (2)]);
}
-#line 3140 "awkgram.c" /* yacc.c:1646 */
break;
case 108:
-#line 1247 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1304 "awkgram.y"
{
/* Ditto */
- (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
+ (yyval) = mk_expression_list((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
}
-#line 3149 "awkgram.c" /* yacc.c:1646 */
break;
case 109:
-#line 1252 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1309 "awkgram.y"
{
/* Ditto */
- (yyval) = (yyvsp[-2]);
+ (yyval) = (yyvsp[(1) - (3)]);
}
-#line 3158 "awkgram.c" /* yacc.c:1646 */
break;
case 110:
-#line 1261 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1318 "awkgram.y"
{
- if (do_lint && (yyvsp[0])->lasti->opcode == Op_match_rec)
- lintwarn_ln((yyvsp[-1])->source_line,
+ if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec)
+ lintwarn_ln((yyvsp[(2) - (3)])->source_line,
_("regular expression on right of assignment"));
- (yyval) = mk_assignment((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1]));
+ (yyval) = mk_assignment((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)]));
}
-#line 3169 "awkgram.c" /* yacc.c:1646 */
break;
case 111:
-#line 1268 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3175 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1325 "awkgram.y"
+ { (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 112:
-#line 1270 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3181 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1327 "awkgram.y"
+ { (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 113:
-#line 1272 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1329 "awkgram.y"
{
- if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
- warning_ln((yyvsp[-1])->source_line,
+ if ((yyvsp[(1) - (3)])->lasti->opcode == Op_match_rec)
+ warning_ln((yyvsp[(2) - (3)])->source_line,
_("regular expression on left of `~' or `!~' operator"));
- if ((yyvsp[0])->lasti == (yyvsp[0])->nexti && (yyvsp[0])->nexti->opcode == Op_match_rec) {
- (yyvsp[-1])->memory = (yyvsp[0])->nexti->memory;
- bcfree((yyvsp[0])->nexti); /* Op_match_rec */
- bcfree((yyvsp[0])); /* Op_list */
- (yyval) = list_append((yyvsp[-2]), (yyvsp[-1]));
+ if ((yyvsp[(3) - (3)])->lasti == (yyvsp[(3) - (3)])->nexti && (yyvsp[(3) - (3)])->nexti->opcode == Op_match_rec) {
+ (yyvsp[(2) - (3)])->memory = (yyvsp[(3) - (3)])->nexti->memory;
+ bcfree((yyvsp[(3) - (3)])->nexti); /* Op_match_rec */
+ bcfree((yyvsp[(3) - (3)])); /* Op_list */
+ (yyval) = list_append((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]));
} else {
- (yyvsp[-1])->memory = make_regnode(Node_dynregex, NULL);
- (yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
+ (yyvsp[(2) - (3)])->memory = make_regnode(Node_dynregex, NULL);
+ (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])), (yyvsp[(2) - (3)]));
}
}
-#line 3201 "awkgram.c" /* yacc.c:1646 */
break;
case 114:
-#line 1288 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1345 "awkgram.y"
{
if (do_lint_old)
- warning_ln((yyvsp[-1])->source_line,
+ warning_ln((yyvsp[(2) - (3)])->source_line,
_("old awk does not support the keyword `in' except after `for'"));
- (yyvsp[0])->nexti->opcode = Op_push_array;
- (yyvsp[-1])->opcode = Op_in_array;
- (yyvsp[-1])->expr_count = 1;
- (yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
+ (yyvsp[(3) - (3)])->nexti->opcode = Op_push_array;
+ (yyvsp[(2) - (3)])->opcode = Op_in_array;
+ (yyvsp[(2) - (3)])->expr_count = 1;
+ (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])), (yyvsp[(2) - (3)]));
}
-#line 3215 "awkgram.c" /* yacc.c:1646 */
break;
case 115:
-#line 1298 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1355 "awkgram.y"
{
- if (do_lint && (yyvsp[0])->lasti->opcode == Op_match_rec)
- lintwarn_ln((yyvsp[-1])->source_line,
+ if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec)
+ lintwarn_ln((yyvsp[(2) - (3)])->source_line,
_("regular expression on right of comparison"));
- (yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
+ (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])), (yyvsp[(2) - (3)]));
}
-#line 3226 "awkgram.c" /* yacc.c:1646 */
break;
case 116:
-#line 1305 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[-1]), (yyvsp[0])); }
-#line 3232 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1362 "awkgram.y"
+ { (yyval) = mk_condition((yyvsp[(1) - (5)]), (yyvsp[(2) - (5)]), (yyvsp[(3) - (5)]), (yyvsp[(4) - (5)]), (yyvsp[(5) - (5)])); }
break;
case 117:
-#line 1307 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3238 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1364 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 118:
-#line 1312 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3244 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1369 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 119:
-#line 1314 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3250 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1371 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 120:
-#line 1316 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1373 "awkgram.y"
{
- (yyvsp[0])->opcode = Op_assign_quotient;
- (yyval) = (yyvsp[0]);
+ (yyvsp[(2) - (2)])->opcode = Op_assign_quotient;
+ (yyval) = (yyvsp[(2) - (2)]);
}
-#line 3259 "awkgram.c" /* yacc.c:1646 */
break;
case 121:
-#line 1324 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3265 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1381 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 122:
-#line 1326 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3271 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1383 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 123:
-#line 1331 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3277 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1388 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 124:
-#line 1333 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3283 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1390 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 125:
-#line 1338 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3289 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1395 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 126:
-#line 1340 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3295 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1397 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 127:
-#line 1342 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1399 "awkgram.y"
{
int count = 2;
bool is_simple_var = false;
- if ((yyvsp[-1])->lasti->opcode == Op_concat) {
+ if ((yyvsp[(1) - (2)])->lasti->opcode == Op_concat) {
/* multiple (> 2) adjacent strings optimization */
- is_simple_var = ((yyvsp[-1])->lasti->concat_flag & CSVAR);
- count = (yyvsp[-1])->lasti->expr_count + 1;
- (yyvsp[-1])->lasti->opcode = Op_no_op;
+ is_simple_var = ((yyvsp[(1) - (2)])->lasti->concat_flag & CSVAR);
+ count = (yyvsp[(1) - (2)])->lasti->expr_count + 1;
+ (yyvsp[(1) - (2)])->lasti->opcode = Op_no_op;
} else {
- is_simple_var = ((yyvsp[-1])->nexti->opcode == Op_push
- && (yyvsp[-1])->lasti == (yyvsp[-1])->nexti); /* first exp. is a simple
+ is_simple_var = ((yyvsp[(1) - (2)])->nexti->opcode == Op_push
+ && (yyvsp[(1) - (2)])->lasti == (yyvsp[(1) - (2)])->nexti); /* first exp. is a simple
* variable?; kludge for use
* in Op_assign_concat.
*/
}
if (do_optimize
- && (yyvsp[-1])->nexti == (yyvsp[-1])->lasti && (yyvsp[-1])->nexti->opcode == Op_push_i
- && (yyvsp[0])->nexti == (yyvsp[0])->lasti && (yyvsp[0])->nexti->opcode == Op_push_i
+ && (yyvsp[(1) - (2)])->nexti == (yyvsp[(1) - (2)])->lasti && (yyvsp[(1) - (2)])->nexti->opcode == Op_push_i
+ && (yyvsp[(2) - (2)])->nexti == (yyvsp[(2) - (2)])->lasti && (yyvsp[(2) - (2)])->nexti->opcode == Op_push_i
) {
- NODE *n1 = (yyvsp[-1])->nexti->memory;
- NODE *n2 = (yyvsp[0])->nexti->memory;
+ NODE *n1 = (yyvsp[(1) - (2)])->nexti->memory;
+ NODE *n2 = (yyvsp[(2) - (2)])->nexti->memory;
size_t nlen;
n1 = force_string(n1);
@@ -3331,184 +3592,184 @@ regular_print:
n1->flags &= ~(NUMCUR|NUMBER|NUMINT);
n1->flags |= (STRING|STRCUR);
unref(n2);
- bcfree((yyvsp[0])->nexti);
- bcfree((yyvsp[0]));
- (yyval) = (yyvsp[-1]);
+ bcfree((yyvsp[(2) - (2)])->nexti);
+ bcfree((yyvsp[(2) - (2)]));
+ (yyval) = (yyvsp[(1) - (2)]);
} else {
- (yyval) = list_append(list_merge((yyvsp[-1]), (yyvsp[0])), instruction(Op_concat));
+ (yyval) = list_append(list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])), instruction(Op_concat));
(yyval)->lasti->concat_flag = (is_simple_var ? CSVAR : 0);
(yyval)->lasti->expr_count = count;
if (count > max_args)
max_args = count;
}
}
-#line 3346 "awkgram.c" /* yacc.c:1646 */
break;
case 129:
-#line 1394 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3352 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1451 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 130:
-#line 1396 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3358 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1453 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 131:
-#line 1398 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3364 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1455 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 132:
-#line 1400 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3370 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1457 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 133:
-#line 1402 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3376 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1459 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 134:
-#line 1404 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3382 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1461 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 135:
-#line 1406 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1463 "awkgram.y"
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
*/
- if ((rule == BEGINFILE || rule == ENDFILE) && (yyvsp[0]) == NULL)
- error_ln((yyvsp[-2])->source_line,
+ if ((rule == BEGINFILE || rule == ENDFILE) && (yyvsp[(3) - (3)]) == NULL)
+ error_ln((yyvsp[(1) - (3)])->source_line,
_("non-redirected `getline' invalid inside `%s' rule"), ruletab[rule]);
- if (do_lint && rule == END && (yyvsp[0]) == NULL)
- lintwarn_ln((yyvsp[-2])->source_line,
+ if (do_lint && rule == END && (yyvsp[(3) - (3)]) == NULL)
+ lintwarn_ln((yyvsp[(1) - (3)])->source_line,
_("non-redirected `getline' undefined inside END action"));
- (yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), redirect_input);
+ (yyval) = mk_getline((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), redirect_input);
}
-#line 3400 "awkgram.c" /* yacc.c:1646 */
break;
case 136:
-#line 1420 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1477 "awkgram.y"
{
- (yyvsp[0])->opcode = Op_postincrement;
- (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
+ (yyvsp[(2) - (2)])->opcode = Op_postincrement;
+ (yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)]));
}
-#line 3409 "awkgram.c" /* yacc.c:1646 */
break;
case 137:
-#line 1425 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1482 "awkgram.y"
{
- (yyvsp[0])->opcode = Op_postdecrement;
- (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
+ (yyvsp[(2) - (2)])->opcode = Op_postdecrement;
+ (yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)]));
}
-#line 3418 "awkgram.c" /* yacc.c:1646 */
break;
case 138:
-#line 1430 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1487 "awkgram.y"
{
if (do_lint_old) {
- warning_ln((yyvsp[-1])->source_line,
+ warning_ln((yyvsp[(4) - (5)])->source_line,
_("old awk does not support the keyword `in' except after `for'"));
- warning_ln((yyvsp[-1])->source_line,
+ warning_ln((yyvsp[(4) - (5)])->source_line,
_("old awk does not support multidimensional arrays"));
}
- (yyvsp[0])->nexti->opcode = Op_push_array;
- (yyvsp[-1])->opcode = Op_in_array;
- if ((yyvsp[-3]) == NULL) { /* error */
+ (yyvsp[(5) - (5)])->nexti->opcode = Op_push_array;
+ (yyvsp[(4) - (5)])->opcode = Op_in_array;
+ if ((yyvsp[(2) - (5)]) == NULL) { /* error */
errcount++;
- (yyvsp[-1])->expr_count = 0;
- (yyval) = list_merge((yyvsp[0]), (yyvsp[-1]));
+ (yyvsp[(4) - (5)])->expr_count = 0;
+ (yyval) = list_merge((yyvsp[(5) - (5)]), (yyvsp[(4) - (5)]));
} else {
- INSTRUCTION *t = (yyvsp[-3]);
- (yyvsp[-1])->expr_count = count_expressions(&t, false);
- (yyval) = list_append(list_merge(t, (yyvsp[0])), (yyvsp[-1]));
+ INSTRUCTION *t = (yyvsp[(2) - (5)]);
+ (yyvsp[(4) - (5)])->expr_count = count_expressions(&t, false);
+ (yyval) = list_append(list_merge(t, (yyvsp[(5) - (5)])), (yyvsp[(4) - (5)]));
}
}
-#line 3442 "awkgram.c" /* yacc.c:1646 */
break;
case 139:
-#line 1455 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1512 "awkgram.y"
{
- (yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), (yyvsp[-2])->redir_type);
- bcfree((yyvsp[-2]));
+ (yyval) = mk_getline((yyvsp[(3) - (4)]), (yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]), (yyvsp[(2) - (4)])->redir_type);
+ bcfree((yyvsp[(2) - (4)]));
}
-#line 3451 "awkgram.c" /* yacc.c:1646 */
break;
case 140:
-#line 1461 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3457 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1518 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 141:
-#line 1463 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3463 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1520 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 142:
-#line 1465 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3469 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1522 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 143:
-#line 1467 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3475 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1524 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 144:
-#line 1469 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3481 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1526 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 145:
-#line 1471 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3487 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1528 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 146:
-#line 1476 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1533 "awkgram.y"
{
- (yyval) = list_create((yyvsp[0]));
+ (yyval) = list_create((yyvsp[(1) - (1)]));
}
-#line 3495 "awkgram.c" /* yacc.c:1646 */
break;
case 147:
-#line 1480 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1537 "awkgram.y"
{
- if ((yyvsp[0])->opcode == Op_match_rec) {
- (yyvsp[0])->opcode = Op_nomatch;
- (yyvsp[-1])->opcode = Op_push_i;
- (yyvsp[-1])->memory = make_number(0.0);
- (yyval) = list_append(list_append(list_create((yyvsp[-1])),
- instruction(Op_field_spec)), (yyvsp[0]));
+ if ((yyvsp[(2) - (2)])->opcode == Op_match_rec) {
+ (yyvsp[(2) - (2)])->opcode = Op_nomatch;
+ (yyvsp[(1) - (2)])->opcode = Op_push_i;
+ (yyvsp[(1) - (2)])->memory = make_number(0.0);
+ (yyval) = list_append(list_append(list_create((yyvsp[(1) - (2)])),
+ instruction(Op_field_spec)), (yyvsp[(2) - (2)]));
} else {
- if (do_optimize && (yyvsp[0])->nexti == (yyvsp[0])->lasti
- && (yyvsp[0])->nexti->opcode == Op_push_i
- && ((yyvsp[0])->nexti->memory->flags & (MPFN|MPZN)) == 0
+ if (do_optimize && (yyvsp[(2) - (2)])->nexti == (yyvsp[(2) - (2)])->lasti
+ && (yyvsp[(2) - (2)])->nexti->opcode == Op_push_i
+ && ((yyvsp[(2) - (2)])->nexti->memory->flags & (MPFN|MPZN)) == 0
) {
- NODE *n = (yyvsp[0])->nexti->memory;
+ NODE *n = (yyvsp[(2) - (2)])->nexti->memory;
if ((n->flags & (STRCUR|STRING)) != 0) {
n->numbr = (AWKNUM) (n->stlen == 0);
n->flags &= ~(STRCUR|STRING);
@@ -3518,139 +3779,139 @@ regular_print:
n->stlen = 0;
} else
n->numbr = (AWKNUM) (n->numbr == 0.0);
- bcfree((yyvsp[-1]));
- (yyval) = (yyvsp[0]);
+ bcfree((yyvsp[(1) - (2)]));
+ (yyval) = (yyvsp[(2) - (2)]);
} else {
- (yyvsp[-1])->opcode = Op_not;
- add_lint((yyvsp[0]), LINT_assign_in_cond);
- (yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
+ (yyvsp[(1) - (2)])->opcode = Op_not;
+ add_lint((yyvsp[(2) - (2)]), LINT_assign_in_cond);
+ (yyval) = list_append((yyvsp[(2) - (2)]), (yyvsp[(1) - (2)]));
}
}
}
-#line 3531 "awkgram.c" /* yacc.c:1646 */
break;
case 148:
-#line 1512 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 3537 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1569 "awkgram.y"
+ { (yyval) = (yyvsp[(2) - (3)]); }
break;
case 149:
-#line 1514 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1571 "awkgram.y"
{
- (yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
+ (yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3547 "awkgram.c" /* yacc.c:1646 */
break;
case 150:
-#line 1520 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1577 "awkgram.y"
{
- (yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
+ (yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3557 "awkgram.c" /* yacc.c:1646 */
break;
case 151:
-#line 1526 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1583 "awkgram.y"
{
static bool warned = false;
if (do_lint && ! warned) {
warned = true;
- lintwarn_ln((yyvsp[0])->source_line,
+ lintwarn_ln((yyvsp[(1) - (1)])->source_line,
_("call of `length' without parentheses is not portable"));
}
- (yyval) = snode(NULL, (yyvsp[0]));
+ (yyval) = snode(NULL, (yyvsp[(1) - (1)]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3574 "awkgram.c" /* yacc.c:1646 */
break;
case 154:
-#line 1541 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1598 "awkgram.y"
{
- (yyvsp[-1])->opcode = Op_preincrement;
- (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
+ (yyvsp[(1) - (2)])->opcode = Op_preincrement;
+ (yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)]));
}
-#line 3583 "awkgram.c" /* yacc.c:1646 */
break;
case 155:
-#line 1546 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1603 "awkgram.y"
{
- (yyvsp[-1])->opcode = Op_predecrement;
- (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
+ (yyvsp[(1) - (2)])->opcode = Op_predecrement;
+ (yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)]));
}
-#line 3592 "awkgram.c" /* yacc.c:1646 */
break;
case 156:
-#line 1551 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1608 "awkgram.y"
{
- (yyval) = list_create((yyvsp[0]));
+ (yyval) = list_create((yyvsp[(1) - (1)]));
}
-#line 3600 "awkgram.c" /* yacc.c:1646 */
break;
case 157:
-#line 1555 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1612 "awkgram.y"
{
- (yyval) = list_create((yyvsp[0]));
+ (yyval) = list_create((yyvsp[(1) - (1)]));
}
-#line 3608 "awkgram.c" /* yacc.c:1646 */
break;
case 158:
-#line 1559 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1616 "awkgram.y"
{
- if ((yyvsp[0])->lasti->opcode == Op_push_i
- && ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) == 0
+ if ((yyvsp[(2) - (2)])->lasti->opcode == Op_push_i
+ && ((yyvsp[(2) - (2)])->lasti->memory->flags & (STRCUR|STRING)) == 0
) {
- NODE *n = (yyvsp[0])->lasti->memory;
+ NODE *n = (yyvsp[(2) - (2)])->lasti->memory;
(void) force_number(n);
negate_num(n);
- (yyval) = (yyvsp[0]);
- bcfree((yyvsp[-1]));
+ (yyval) = (yyvsp[(2) - (2)]);
+ bcfree((yyvsp[(1) - (2)]));
} else {
- (yyvsp[-1])->opcode = Op_unary_minus;
- (yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
+ (yyvsp[(1) - (2)])->opcode = Op_unary_minus;
+ (yyval) = list_append((yyvsp[(2) - (2)]), (yyvsp[(1) - (2)]));
}
}
-#line 3627 "awkgram.c" /* yacc.c:1646 */
break;
case 159:
-#line 1574 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1631 "awkgram.y"
{
/*
* was: $$ = $2
* POSIX semantics: force a conversion to numeric type
*/
- (yyvsp[-1])->opcode = Op_plus_i;
- (yyvsp[-1])->memory = make_number(0.0);
- (yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
+ (yyvsp[(1) - (2)])->opcode = Op_plus_i;
+ (yyvsp[(1) - (2)])->memory = make_number(0.0);
+ (yyval) = list_append((yyvsp[(2) - (2)]), (yyvsp[(1) - (2)]));
}
-#line 3641 "awkgram.c" /* yacc.c:1646 */
break;
case 160:
-#line 1587 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1644 "awkgram.y"
{
- func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
- (yyval) = (yyvsp[0]);
+ func_use((yyvsp[(1) - (1)])->lasti->func_name, FUNC_USE);
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 3650 "awkgram.c" /* yacc.c:1646 */
break;
case 161:
-#line 1592 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1649 "awkgram.y"
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -3666,7 +3927,7 @@ regular_print:
lintwarn("%s", msg);
}
- f = (yyvsp[0])->lasti;
+ f = (yyvsp[(2) - (2)])->lasti;
f->opcode = Op_indirect_func_call;
name = estrdup(f->func_name, strlen(f->func_name));
if (is_std_var(name))
@@ -3681,71 +3942,71 @@ regular_print:
* @f(f="real_fun")
*/
- (yyval) = list_prepend((yyvsp[0]), t);
+ (yyval) = list_prepend((yyvsp[(2) - (2)]), t);
}
-#line 3687 "awkgram.c" /* yacc.c:1646 */
break;
case 162:
-#line 1628 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1685 "awkgram.y"
{
- param_sanity((yyvsp[-1]));
- (yyvsp[-3])->opcode = Op_func_call;
- (yyvsp[-3])->func_body = NULL;
- if ((yyvsp[-1]) == NULL) { /* no argument or error */
- ((yyvsp[-3]) + 1)->expr_count = 0;
- (yyval) = list_create((yyvsp[-3]));
+ param_sanity((yyvsp[(3) - (4)]));
+ (yyvsp[(1) - (4)])->opcode = Op_func_call;
+ (yyvsp[(1) - (4)])->func_body = NULL;
+ if ((yyvsp[(3) - (4)]) == NULL) { /* no argument or error */
+ ((yyvsp[(1) - (4)]) + 1)->expr_count = 0;
+ (yyval) = list_create((yyvsp[(1) - (4)]));
} else {
- INSTRUCTION *t = (yyvsp[-1]);
- ((yyvsp[-3]) + 1)->expr_count = count_expressions(&t, true);
- (yyval) = list_append(t, (yyvsp[-3]));
+ INSTRUCTION *t = (yyvsp[(3) - (4)]);
+ ((yyvsp[(1) - (4)]) + 1)->expr_count = count_expressions(&t, true);
+ (yyval) = list_append(t, (yyvsp[(1) - (4)]));
}
}
-#line 3705 "awkgram.c" /* yacc.c:1646 */
break;
case 163:
-#line 1645 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1702 "awkgram.y"
{ (yyval) = NULL; }
-#line 3711 "awkgram.c" /* yacc.c:1646 */
break;
case 164:
-#line 1647 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3717 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1704 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 165:
-#line 1652 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1709 "awkgram.y"
{ (yyval) = NULL; }
-#line 3723 "awkgram.c" /* yacc.c:1646 */
break;
case 166:
-#line 1654 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 3729 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1711 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (2)]); }
break;
case 167:
-#line 1659 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3735 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1716 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 168:
-#line 1661 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1718 "awkgram.y"
{
- (yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
+ (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
-#line 3743 "awkgram.c" /* yacc.c:1646 */
break;
case 169:
-#line 1668 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1725 "awkgram.y"
{
- INSTRUCTION *ip = (yyvsp[0])->lasti;
+ INSTRUCTION *ip = (yyvsp[(1) - (1)])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
if (count > 1) {
/* change Op_subscript or Op_sub_array to Op_concat */
@@ -3755,152 +4016,152 @@ regular_print:
} else
ip->opcode = Op_no_op;
sub_counter++; /* count # of dimensions */
- (yyval) = (yyvsp[0]);
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 3761 "awkgram.c" /* yacc.c:1646 */
break;
case 170:
-#line 1685 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1742 "awkgram.y"
{
- INSTRUCTION *t = (yyvsp[-1]);
- if ((yyvsp[-1]) == NULL) {
- error_ln((yyvsp[0])->source_line,
+ INSTRUCTION *t = (yyvsp[(2) - (3)]);
+ if ((yyvsp[(2) - (3)]) == NULL) {
+ error_ln((yyvsp[(3) - (3)])->source_line,
_("invalid subscript expression"));
/* install Null string as subscript. */
t = list_create(instruction(Op_push_i));
t->nexti->memory = dupnode(Nnull_string);
- (yyvsp[0])->sub_count = 1;
+ (yyvsp[(3) - (3)])->sub_count = 1;
} else
- (yyvsp[0])->sub_count = count_expressions(&t, false);
- (yyval) = list_append(t, (yyvsp[0]));
+ (yyvsp[(3) - (3)])->sub_count = count_expressions(&t, false);
+ (yyval) = list_append(t, (yyvsp[(3) - (3)]));
}
-#line 3779 "awkgram.c" /* yacc.c:1646 */
break;
case 171:
-#line 1702 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 3785 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1759 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
case 172:
-#line 1704 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1761 "awkgram.y"
{
- (yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
+ (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
-#line 3793 "awkgram.c" /* yacc.c:1646 */
break;
case 173:
-#line 1711 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 3799 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1768 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (2)]); }
break;
case 174:
-#line 1716 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1773 "awkgram.y"
{
- char *var_name = (yyvsp[0])->lextok;
+ char *var_name = (yyvsp[(1) - (1)])->lextok;
- (yyvsp[0])->opcode = Op_push;
- (yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new);
- (yyval) = list_create((yyvsp[0]));
+ (yyvsp[(1) - (1)])->opcode = Op_push;
+ (yyvsp[(1) - (1)])->memory = variable((yyvsp[(1) - (1)])->source_line, var_name, Node_var_new);
+ (yyval) = list_create((yyvsp[(1) - (1)]));
}
-#line 3811 "awkgram.c" /* yacc.c:1646 */
break;
case 175:
-#line 1724 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1781 "awkgram.y"
{
- char *arr = (yyvsp[-1])->lextok;
- (yyvsp[-1])->memory = variable((yyvsp[-1])->source_line, arr, Node_var_new);
- (yyvsp[-1])->opcode = Op_push_array;
- (yyval) = list_prepend((yyvsp[0]), (yyvsp[-1]));
+ char *arr = (yyvsp[(1) - (2)])->lextok;
+ (yyvsp[(1) - (2)])->memory = variable((yyvsp[(1) - (2)])->source_line, arr, Node_var_new);
+ (yyvsp[(1) - (2)])->opcode = Op_push_array;
+ (yyval) = list_prepend((yyvsp[(2) - (2)]), (yyvsp[(1) - (2)]));
}
-#line 3822 "awkgram.c" /* yacc.c:1646 */
break;
case 176:
-#line 1734 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1791 "awkgram.y"
{
- INSTRUCTION *ip = (yyvsp[0])->nexti;
+ INSTRUCTION *ip = (yyvsp[(1) - (1)])->nexti;
if (ip->opcode == Op_push
&& ip->memory->type == Node_var
&& ip->memory->var_update
) {
- (yyval) = list_prepend((yyvsp[0]), instruction(Op_var_update));
+ (yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_var_update));
(yyval)->nexti->update_var = ip->memory->var_update;
} else
- (yyval) = (yyvsp[0]);
+ (yyval) = (yyvsp[(1) - (1)]);
}
-#line 3838 "awkgram.c" /* yacc.c:1646 */
break;
case 177:
-#line 1746 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1803 "awkgram.y"
{
- (yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
- if ((yyvsp[0]) != NULL)
- mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
+ (yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)]));
+ if ((yyvsp[(3) - (3)]) != NULL)
+ mk_assignment((yyvsp[(2) - (3)]), NULL, (yyvsp[(3) - (3)]));
}
-#line 3848 "awkgram.c" /* yacc.c:1646 */
break;
case 178:
-#line 1755 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1812 "awkgram.y"
{
- (yyvsp[0])->opcode = Op_postincrement;
+ (yyvsp[(1) - (1)])->opcode = Op_postincrement;
}
-#line 3856 "awkgram.c" /* yacc.c:1646 */
break;
case 179:
-#line 1759 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1816 "awkgram.y"
{
- (yyvsp[0])->opcode = Op_postdecrement;
+ (yyvsp[(1) - (1)])->opcode = Op_postdecrement;
}
-#line 3864 "awkgram.c" /* yacc.c:1646 */
break;
case 180:
-#line 1762 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1819 "awkgram.y"
{ (yyval) = NULL; }
-#line 3870 "awkgram.c" /* yacc.c:1646 */
break;
case 182:
-#line 1770 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1827 "awkgram.y"
{ yyerrok; }
-#line 3876 "awkgram.c" /* yacc.c:1646 */
break;
case 183:
-#line 1774 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1831 "awkgram.y"
{ yyerrok; }
-#line 3882 "awkgram.c" /* yacc.c:1646 */
break;
case 186:
-#line 1783 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1840 "awkgram.y"
{ yyerrok; }
-#line 3888 "awkgram.c" /* yacc.c:1646 */
break;
case 187:
-#line 1787 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); yyerrok; }
-#line 3894 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1844 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); yyerrok; }
break;
case 188:
-#line 1791 "awkgram.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 1848 "awkgram.y"
{ yyerrok; }
-#line 3900 "awkgram.c" /* yacc.c:1646 */
break;
-#line 3904 "awkgram.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 4165 "awkgram.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -3922,7 +4183,7 @@ regular_print:
*++yyvsp = yyval;
- /* Now 'shift' the result of the reduction. Determine what state
+ /* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -3937,9 +4198,9 @@ regular_print:
goto yynewstate;
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -3990,20 +4251,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -4022,7 +4283,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -4035,29 +4296,29 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
+ yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -4108,14 +4369,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
+ yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -4126,9 +4387,13 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- return yyresult;
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
-#line 1793 "awkgram.y" /* yacc.c:1906 */
+
+
+/* Line 2055 of yacc.c */
+#line 1850 "awkgram.y"
struct token {
@@ -4562,6 +4827,8 @@ mk_program()
cp = end_block;
else
cp = list_merge(begin_block, end_block);
+ if (comment != NULL)
+ (void) list_append(cp, comment);
(void) list_append(cp, ip_atexit);
(void) list_append(cp, instruction(Op_stop));
@@ -4594,6 +4861,12 @@ mk_program()
if (begin_block != NULL)
cp = list_merge(begin_block, cp);
+ if (comment0 != NULL){
+ (void) list_prepend(cp, comment0);
+ }
+ if (comment != NULL){
+ (void) list_append(cp, comment);
+ }
(void) list_append(cp, ip_atexit);
(void) list_append(cp, instruction(Op_stop));
@@ -5267,6 +5540,78 @@ pushback(void)
}
+/* get_comment --- collect comment text */
+
+int get_comment(void)
+{
+ int c;
+ int sl;
+ tok = tokstart;
+ tokadd('#');
+ sl = sourceline;
+
+ while (true){
+ while ((c = nextc(false)) != '\n' && c != END_FILE){
+ tokadd(c);
+ }
+ if (c == '\n'){
+ tokadd(c);
+ sourceline++;
+ do {
+ c = nextc(false);
+ if (c == '\n') {
+ sourceline++;
+ tokadd(c);
+ }
+ } while (isspace(c) && c != END_FILE) ;
+ if ( c == END_FILE)
+ break;
+ else if (c != '#'){
+ pushback();
+ break;
+ } else
+ tokadd(c);
+ } else
+ break;
+ }
+ comment = bcalloc(Op_comment, 1, sl);
+ comment->source_file = source;
+ comment->memory = make_str_node(tokstart, tok - tokstart, 0);
+
+ return c;
+}
+
+/* split_comment --- split initial comment text into program and function parts */
+
+void split_comment(void)
+{
+ char *p;
+ int l;
+ int j;
+ NODE *n;
+
+ p = comment->memory->stptr;
+ l = comment->memory->stlen - 3;
+ /* have at least two comments so split at last blank line ( \n\n) */
+ while (l >= 0){
+ if (p[l] == '\n' && p[l+1] == '\n'){
+ commentf = comment;
+ n = commentf->memory;
+ commentf->memory = make_str_node(p + l + 2, n->stlen - l - 2, 0);
+ /* create program comment */
+ comment0 = bcalloc(Op_comment, 1, sourceline);
+ comment0->source_file = comment->source_file;
+ p[l + 2] = 0;
+ comment0->memory = make_str_node(p , l + 2, 0);
+ comment = NULL;
+ freenode(n);
+ break;
+ }
+ else l--;
+ }
+
+}
+
/* allow_newline --- allow newline after &&, ||, ? and : */
static void
@@ -5281,8 +5626,13 @@ allow_newline(void)
break;
}
if (c == '#') {
- while ((c = nextc(false)) != '\n' && c != END_FILE)
- continue;
+ if (do_pretty_print && !do_profile) {
+ /* collect comment byte code iff doing pretty print but not profiling. */
+ c = get_comment();
+ } else {
+ while ((c = nextc(false)) != '\n' && c != END_FILE)
+ continue;
+ }
if (c == END_FILE) {
pushback();
break;
@@ -5486,9 +5836,17 @@ retry:
return lasttok = NEWLINE;
case '#': /* it's a comment */
- while ((c = nextc(false)) != '\n') {
+ if (do_pretty_print && ! do_profile) {
+ /* collect comment byte code iff doing pretty print but not profiling. */
+ c = get_comment();
+
if (c == END_FILE)
return lasttok = NEWLINE_EOF;
+ } else {
+ while ((c = nextc(false)) != '\n') {
+ if (c == END_FILE)
+ return lasttok = NEWLINE_EOF;
+ }
}
sourceline++;
return lasttok = NEWLINE;
@@ -5499,7 +5857,7 @@ retry:
case '\\':
#ifdef RELAXED_CONTINUATION
/*
- * This code puports to allow comments and/or whitespace
+ * This code purports to allow comments and/or whitespace
* after the `\' at the end of a line used for continuation.
* Use it at your own risk. We think it's a bad idea, which
* is why it's not on by default.
@@ -5516,9 +5874,13 @@ retry:
lintwarn(
_("use of `\\ #...' line continuation is not portable"));
}
- while ((c = nextc(false)) != '\n')
- if (c == END_FILE)
- break;
+ if (do_pretty_print && !do_profile)
+ c = get_comment();
+ else {
+ while ((c = nextc(false)) != '\n')
+ if (c == END_FILE)
+ break;
+ }
}
pushback();
}
@@ -5730,7 +6092,7 @@ retry:
lastline = sourceline;
return lasttok = c;
}
- did_newline++;
+ did_newline = true;
--lexptr; /* pick up } next time */
return lasttok = NEWLINE;
@@ -6579,6 +6941,14 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
(t + 1)->tail_call = true;
}
+ /* add any pre-function comment to start of action for profile.c */
+
+ if (commentf != NULL){
+ commentf->source_line = 0;
+ (void) list_prepend(def, commentf);
+ commentf = NULL;
+ }
+
/* add an implicit return at end;
* also used by 'return' command in debugger
*/
@@ -7398,7 +7768,6 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action)
action),
tp);
}
-
}
list_append(rule_list, rp + 1);
diff --git a/awkgram.y b/awkgram.y
index 0f57b452..19ab4d68 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -87,6 +87,7 @@ static void check_funcs(void);
static ssize_t read_one_line(int fd, void *buffer, size_t count);
static int one_line_close(int fd);
+void split_comment(void);
static bool want_source = false;
static bool want_regexp = false; /* lexical scanning kludge */
@@ -146,6 +147,12 @@ static INSTRUCTION *ip_end;
static INSTRUCTION *ip_endfile;
static INSTRUCTION *ip_beginfile;
+static INSTRUCTION *comment = NULL;
+static INSTRUCTION *comment0 = NULL;
+static INSTRUCTION *commentf = NULL;
+
+static int func_first = 1;
+
static inline INSTRUCTION *list_create(INSTRUCTION *x);
static inline INSTRUCTION *list_append(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
@@ -288,9 +295,22 @@ library
pattern
: /* empty */
- { $$ = NULL; rule = Rule; }
+ { rule = Rule;
+ if (comment != NULL){
+ $$ = list_create(comment);
+ comment = NULL;
+ } else
+ $$ = NULL;
+ }
| exp
- { $$ = $1; rule = Rule; }
+ { rule = Rule;
+ if (comment != NULL){
+ $$ = list_prepend($1, comment);
+ comment = NULL;
+ } else
+ $$ = $1;
+ }
+
| exp ',' opt_nls exp
{
INSTRUCTION *tp;
@@ -320,6 +340,8 @@ pattern
| LEX_BEGIN
{
static int begin_seen = 0;
+ func_first = 0;
+ INSTRUCTION *ip;
if (do_lint_old && ++begin_seen == 2)
warning_ln($1->source_line,
_("old awk does not support multiple `BEGIN' or `END' rules"));
@@ -331,6 +353,7 @@ pattern
| LEX_END
{
static int end_seen = 0;
+ func_first = 0;
if (do_lint_old && ++end_seen == 2)
warning_ln($1->source_line,
_("old awk does not support multiple `BEGIN' or `END' rules"));
@@ -341,12 +364,14 @@ pattern
}
| LEX_BEGINFILE
{
+ func_first = 0;
$1->in_rule = rule = BEGINFILE;
$1->source_file = source;
$$ = $1;
}
| LEX_ENDFILE
{
+ func_first = 0;
$1->in_rule = rule = ENDFILE;
$1->source_file = source;
$$ = $1;
@@ -356,10 +381,12 @@ pattern
action
: l_brace statements r_brace opt_semi opt_nls
{
+ INSTRUCTION *ip;
if ($2 == NULL)
- $$ = list_create(instruction(Op_no_op));
+ ip = list_create(instruction(Op_no_op));
else
- $$ = $2;
+ ip = $2;
+ $$ = ip;
}
;
@@ -386,6 +413,16 @@ lex_builtin
function_prologue
: LEX_FUNCTION func_name '(' opt_param_list r_paren opt_nls
{
+/* treat any comments between BOF and the first function definition (with no intervening BEGIN etc block) as program comments
+ Special kludge: iff there are more than one such comments, treat the last as a function comment. */
+ if (comment != NULL && func_first && strstr(comment->memory->stptr, "\n\n") != NULL)
+ split_comment();
+ /* save any other pre-function comment as function comment */
+ if (comment != NULL){
+ commentf = comment;
+ comment = NULL;
+ }
+ func_first = 0;
$1->source_file = source;
if (install_function($2->lextok, $1, $4) < 0)
YYABORT;
@@ -443,19 +480,39 @@ a_slash
statements
: /* empty */
- { $$ = NULL; }
+ {
+ if (comment != NULL){
+ $$ = list_create(comment);
+ comment = NULL;
+ } else $$ = NULL;
+ }
| statements statement
{
- if ($2 == NULL)
- $$ = $1;
- else {
+ if ($2 == NULL) {
+ if (comment == NULL)
+ $$ = $1;
+ else {
+ $$ = list_append($1, comment);
+ comment = NULL;
+ }
+ } else {
add_lint($2, LINT_no_effect);
- if ($1 == NULL)
- $$ = $2;
- else
+ if ($1 == NULL) {
+ if (comment == NULL)
+ $$ = $2;
+ else {
+ $$ = list_append($2, comment);
+ comment = NULL;
+ }
+ } else {
+ if (comment != NULL){
+ list_append($2, comment);
+ comment = NULL;
+ }
$$ = list_merge($1, $2);
+ }
}
- yyerrok;
+ yyerrok;
}
| statements error
{ $$ = NULL; }
@@ -470,7 +527,7 @@ statement
: semi opt_nls
{ $$ = NULL; }
| l_brace statements r_brace
- { $$ = $2; }
+ { $$ = $2; }
| if_statement
{
if (do_pretty_print)
@@ -2223,6 +2280,8 @@ mk_program()
cp = end_block;
else
cp = list_merge(begin_block, end_block);
+ if (comment != NULL)
+ (void) list_append(cp, comment);
(void) list_append(cp, ip_atexit);
(void) list_append(cp, instruction(Op_stop));
@@ -2255,6 +2314,12 @@ mk_program()
if (begin_block != NULL)
cp = list_merge(begin_block, cp);
+ if (comment0 != NULL){
+ (void) list_prepend(cp, comment0);
+ }
+ if (comment != NULL){
+ (void) list_append(cp, comment);
+ }
(void) list_append(cp, ip_atexit);
(void) list_append(cp, instruction(Op_stop));
@@ -2928,6 +2993,78 @@ pushback(void)
}
+/* get_comment --- collect comment text */
+
+int get_comment(void)
+{
+ int c;
+ int sl;
+ tok = tokstart;
+ tokadd('#');
+ sl = sourceline;
+
+ while (true){
+ while ((c = nextc(false)) != '\n' && c != END_FILE){
+ tokadd(c);
+ }
+ if (c == '\n'){
+ tokadd(c);
+ sourceline++;
+ do {
+ c = nextc(false);
+ if (c == '\n') {
+ sourceline++;
+ tokadd(c);
+ }
+ } while (isspace(c) && c != END_FILE) ;
+ if ( c == END_FILE)
+ break;
+ else if (c != '#'){
+ pushback();
+ break;
+ } else
+ tokadd(c);
+ } else
+ break;
+ }
+ comment = bcalloc(Op_comment, 1, sl);
+ comment->source_file = source;
+ comment->memory = make_str_node(tokstart, tok - tokstart, 0);
+
+ return c;
+}
+
+/* split_comment --- split initial comment text into program and function parts */
+
+void split_comment(void)
+{
+ char *p;
+ int l;
+ int j;
+ NODE *n;
+
+ p = comment->memory->stptr;
+ l = comment->memory->stlen - 3;
+ /* have at least two comments so split at last blank line ( \n\n) */
+ while (l >= 0){
+ if (p[l] == '\n' && p[l+1] == '\n'){
+ commentf = comment;
+ n = commentf->memory;
+ commentf->memory = make_str_node(p + l + 2, n->stlen - l - 2, 0);
+ /* create program comment */
+ comment0 = bcalloc(Op_comment, 1, sourceline);
+ comment0->source_file = comment->source_file;
+ p[l + 2] = 0;
+ comment0->memory = make_str_node(p , l + 2, 0);
+ comment = NULL;
+ freenode(n);
+ break;
+ }
+ else l--;
+ }
+
+}
+
/* allow_newline --- allow newline after &&, ||, ? and : */
static void
@@ -2942,8 +3079,13 @@ allow_newline(void)
break;
}
if (c == '#') {
- while ((c = nextc(false)) != '\n' && c != END_FILE)
- continue;
+ if (do_pretty_print && !do_profile) {
+ /* collect comment byte code iff doing pretty print but not profiling. */
+ c = get_comment();
+ } else {
+ while ((c = nextc(false)) != '\n' && c != END_FILE)
+ continue;
+ }
if (c == END_FILE) {
pushback();
break;
@@ -3147,9 +3289,17 @@ retry:
return lasttok = NEWLINE;
case '#': /* it's a comment */
- while ((c = nextc(false)) != '\n') {
+ if (do_pretty_print && ! do_profile) {
+ /* collect comment byte code iff doing pretty print but not profiling. */
+ c = get_comment();
+
if (c == END_FILE)
return lasttok = NEWLINE_EOF;
+ } else {
+ while ((c = nextc(false)) != '\n') {
+ if (c == END_FILE)
+ return lasttok = NEWLINE_EOF;
+ }
}
sourceline++;
return lasttok = NEWLINE;
@@ -3160,7 +3310,7 @@ retry:
case '\\':
#ifdef RELAXED_CONTINUATION
/*
- * This code puports to allow comments and/or whitespace
+ * This code purports to allow comments and/or whitespace
* after the `\' at the end of a line used for continuation.
* Use it at your own risk. We think it's a bad idea, which
* is why it's not on by default.
@@ -3177,9 +3327,13 @@ retry:
lintwarn(
_("use of `\\ #...' line continuation is not portable"));
}
- while ((c = nextc(false)) != '\n')
- if (c == END_FILE)
- break;
+ if (do_pretty_print && !do_profile)
+ c = get_comment();
+ else {
+ while ((c = nextc(false)) != '\n')
+ if (c == END_FILE)
+ break;
+ }
}
pushback();
}
@@ -3391,7 +3545,7 @@ retry:
lastline = sourceline;
return lasttok = c;
}
- did_newline++;
+ did_newline = true;
--lexptr; /* pick up } next time */
return lasttok = NEWLINE;
@@ -4240,6 +4394,14 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
(t + 1)->tail_call = true;
}
+ /* add any pre-function comment to start of action for profile.c */
+
+ if (commentf != NULL){
+ commentf->source_line = 0;
+ (void) list_prepend(def, commentf);
+ commentf = NULL;
+ }
+
/* add an implicit return at end;
* also used by 'return' command in debugger
*/
@@ -5059,7 +5221,6 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action)
action),
tp);
}
-
}
list_append(rule_list, rp + 1);
diff --git a/debug.c b/debug.c
index 5d7db01b..58012b72 100644
--- a/debug.c
+++ b/debug.c
@@ -3995,6 +3995,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
case Op_quotient_i:
case Op_mod_i:
case Op_assign_concat:
+ case Op_comment:
print_memory(pc->memory, func, print_func, fp);
/* fall through */
default:
diff --git a/eval.c b/eval.c
index 5649797f..f4e1db64 100644
--- a/eval.c
+++ b/eval.c
@@ -361,6 +361,7 @@ static struct optypetab {
{ "Op_after_beginfile", NULL },
{ "Op_after_endfile", NULL },
{ "Op_func", NULL },
+ { "Op_comment", NULL },
{ "Op_exec_count", NULL },
{ "Op_breakpoint", NULL },
{ "Op_lint", NULL },
diff --git a/extension/ChangeLog b/extension/ChangeLog
index f324bdeb..cae97deb 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -143,6 +143,10 @@
"not supported" fatal message. This is slightly better than the
"fts not found" which is otherwise produced.
+2013-07-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile2.ok, profile5.ok: Update.
+
2013-07-24 Arnold D. Robbins <arnold@skeeve.com>
* gawkdirfd.h (FAKE_FD_VALUE): Move definition up in the file to give
diff --git a/interpret.h b/interpret.h
index 28804330..23ce0c1a 100644
--- a/interpret.h
+++ b/interpret.h
@@ -1390,6 +1390,7 @@ match_re:
case Op_K_if:
case Op_K_else:
case Op_cond_exp:
+ case Op_comment:
break;
default:
diff --git a/profile.c b/profile.c
index d07bea4a..3c4c9181 100644
--- a/profile.c
+++ b/profile.c
@@ -36,7 +36,8 @@ static bool is_scalar(int type);
static int prec_level(int type);
static void pp_push(int type, char *s, int flag);
static NODE *pp_pop(void);
-static void pp_free(NODE *n);
+static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header);
+static void print_comment(INSTRUCTION *pc, long in);
const char *redir2str(int redirtype);
#define pp_str vname
@@ -100,10 +101,11 @@ indent(long count)
{
int i;
- if (count == 0)
- fprintf(prof_fp, "\t");
- else
- fprintf(prof_fp, "%6ld ", count);
+ if (do_profile)
+ if (count == 0)
+ fprintf(prof_fp, "\t");
+ else
+ fprintf(prof_fp, "%6ld ", count);
assert(indent_level >= 0);
for (i = 0; i < indent_level; i++)
@@ -177,6 +179,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header)
NODE *m;
char *tmp;
int rule;
+ long lind;
static int rule_count[MAXRULE];
for (pc = startp; pc != endp; pc = pc->nexti) {
@@ -189,16 +192,35 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header)
rule = pc->in_rule;
if (rule != Rule) {
- if (! rule_count[rule]++)
- fprintf(prof_fp, _("\t# %s block(s)\n\n"), ruletab[rule]);
- fprintf(prof_fp, "\t%s {\n", ruletab[rule]);
ip = (pc + 1)->firsti;
+
+ /* print pre-begin/end comments */
+ if (ip->opcode == Op_comment) {
+ print_comment(ip, 0);
+ ip = ip->nexti;
+ }
+
+ if (do_profile) {
+ if (! rule_count[rule]++)
+ fprintf(prof_fp, _("\t# %s block(s)\n\n"), ruletab[rule]);
+ indent(0);
+ }
+ fprintf(prof_fp, "%s {\n", ruletab[rule]);
} else {
- if (! rule_count[rule]++)
+ if (do_profile && ! rule_count[rule]++)
fprintf(prof_fp, _("\t# Rule(s)\n\n"));
ip = pc->nexti;
- indent(ip->exec_count);
+ lind = ip->exec_count;
+ /* print pre-block comments */
+ if (ip->opcode == Op_exec_count && ip->nexti->opcode == Op_comment)
+ ip = ip->nexti;
+ if (ip->opcode == Op_comment) {
+ print_comment(ip, lind);
+ if (ip->nexti->nexti == (pc + 1)->firsti)
+ ip = ip->nexti->nexti;
+ }
if (ip != (pc + 1)->firsti) { /* non-empty pattern */
+ indent(lind);
pprint(ip->nexti, (pc + 1)->firsti, false);
t1 = pp_pop();
fprintf(prof_fp, "%s {", t1->pp_str);
@@ -218,7 +240,9 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header)
indent_in();
pprint(ip, (pc + 1)->lasti, false);
indent_out();
- fprintf(prof_fp, "\t}\n\n");
+ if (do_profile)
+ indent(0);
+ fprintf(prof_fp, "}\n\n");
pc = (pc + 1)->lasti;
break;
@@ -881,6 +905,12 @@ cleanup:
indent(pc->exec_count);
break;
+ case Op_comment:
+ print_comment(pc, 0);
+ break;
+
+ case Op_list:
+ break;
default:
cant_happen();
}
@@ -963,6 +993,29 @@ print_lib_list(FILE *prof_fp)
fprintf(prof_fp, "\n");
}
+/* print comment text with proper indentation */
+static void
+print_comment(INSTRUCTION* pc, long in)
+{
+ char *text;
+ size_t count;
+ bool after_newline = false;
+
+ count = pc->memory->stlen;
+ text = pc->memory->stptr;
+
+ indent(in); /* is this correct? Where should comments go? */
+ for (; count > 0; count--, text++) {
+ if (after_newline) {
+ indent(in);
+ after_newline = false;
+ }
+ putc(*text, prof_fp);
+ if (*text == '\n')
+ after_newline = true;
+ }
+}
+
/* dump_prog --- dump the program */
/*
@@ -977,7 +1030,8 @@ dump_prog(INSTRUCTION *code)
(void) time(& now);
/* \n on purpose, with \n in ctime() output */
- fprintf(prof_fp, _("\t# gawk profile, created %s\n"), ctime(& now));
+ if (do_profile)
+ fprintf(prof_fp, _("\t# gawk profile, created %s\n"), ctime(& now));
print_lib_list(prof_fp);
pprint(code, NULL, false);
}
@@ -1477,14 +1531,24 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
static bool first = true;
NODE *func;
int pcount;
+ INSTRUCTION *fp;
if (first) {
first = false;
- fprintf(prof_fp, _("\n\t# Functions, listed alphabetically\n"));
+ if (do_profile)
+ fprintf(prof_fp, _("\n\t# Functions, listed alphabetically\n"));
}
+ fp = pc->nexti->nexti;
func = pc->func_body;
fprintf(prof_fp, "\n");
+
+ /* print any function comment */
+ if (fp->opcode == Op_comment && fp->source_line == 0) {
+ print_comment(fp, 0);
+ fp = fp->nexti;
+ }
+
indent(pc->nexti->exec_count);
fprintf(prof_fp, "%s %s(", op2str(Op_K_function), func->vname);
pcount = func->param_cnt;
@@ -1494,11 +1558,16 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
if (j < pcount - 1)
fprintf(prof_fp, ", ");
}
- fprintf(prof_fp, ")\n\t{\n");
+ fprintf(prof_fp, ")\n");
+ if (do_profile)
+ indent(0);
+ fprintf(prof_fp, "{\n");
indent_in();
- pprint(pc->nexti->nexti, NULL, false); /* function body */
+ pprint(fp, NULL, false); /* function body */
indent_out();
- fprintf(prof_fp, "\t}\n");
+ if (do_profile)
+ indent(0);
+ fprintf(prof_fp, "}\n");
return 0;
}
diff --git a/test/ChangeLog b/test/ChangeLog
index 68cc18e6..0cd7e5f3 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2014-09-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile2.ok, profile4.ok, profile5.ok: Update for new code.
+
2014-09-05 Arnold D. Robbins <arnold@skeeve.com>
* functab4.awk: Changed to use stat instead of chdir since
diff --git a/test/Makefile.am b/test/Makefile.am
index 3be8b7cb..3b53ea9f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1688,14 +1688,12 @@ profile3:
profile4:
@echo $@
- @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
- @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
+ @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
profile5:
@echo $@
- @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
- @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
+ @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
posix2008sub:
diff --git a/test/Makefile.in b/test/Makefile.in
index b9753369..4cd850f5 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -2112,14 +2112,12 @@ profile3:
profile4:
@echo $@
- @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
- @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
+ @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
profile5:
@echo $@
- @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
- @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
+ @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
posix2008sub:
diff --git a/test/profile4.ok b/test/profile4.ok
index 8ff4470f..9d2b9430 100644
--- a/test/profile4.ok
+++ b/test/profile4.ok
@@ -1,11 +1,9 @@
- # BEGIN block(s)
-
- BEGIN {
- a = "foo" (c = "bar")
- a = (b - c) "foo"
- a = "foo" (b - c)
- q = (d = "x") (e = "y")
- a = (c = tolower("FOO")) in JUNK
- x = y == 0 && z == 2 && q == 45
- }
+BEGIN {
+ a = "foo" (c = "bar")
+ a = (b - c) "foo"
+ a = "foo" (b - c)
+ q = (d = "x") (e = "y")
+ a = (c = tolower("FOO")) in JUNK
+ x = y == 0 && z == 2 && q == 45
+}
diff --git a/test/profile5.ok b/test/profile5.ok
index cc83dc06..4c944627 100644
--- a/test/profile5.ok
+++ b/test/profile5.ok
@@ -1,4770 +1,5728 @@
- # BEGIN block(s)
+BEGIN {
+ _addlib("_BASE")
+}
+
+############################################################################
+
+BEGIN {
+ BINMODE = "rw"
+ SUBSEP = "\000"
+ _NULARR[""]
+ delete _NULARR[""]
+ _INITBASE()
+}
+
+BEGIN {
+ _addlib("_sYS")
+}
+
+BEGIN {
+ _addlib("_rEG")
+}
+
+BEGIN {
+ _addlib("_INSTRUC")
+}
+
+#############################################################################
+
+BEGIN {
+ _delay_perfmsdelay = 11500
+}
+
+BEGIN {
+ _addlib("_ARR")
+}
+
+#___________________________________________________________________________________
+BEGIN {
+}
+
+###########################################################################
+
+
+
+
+
+
+BEGIN {
+ _addlib("_EXTFN")
+}
+
+#############################################################################
+
+BEGIN {
+ delete _XCHR
+ delete _ASC
+ delete _CHR
+ t = ""
+ for (i = 0; i < 256; i++) {
+ _ASC[a = _CHR[i] = sprintf("%c", i)] = i
+ _QASC[a] = sprintf("%.3o", i)
+ _XCHR[_CHR[i]] = sprintf("%c", (i < 128 ? i + 128 : i - 128))
+ }
+ #_____________________________________________________________________________
+
+ for (i = 0; i < 256; i++) {
+ _QSTRQ[_CHR[i]] = "\\" sprintf("%.3o", i)
+ }
+ #_______________________________________________________________________
+
+ for (i = 0; i < 32; i++) {
+ _QSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
+ }
+ for (; i < 128; i++) {
+ _QSTR[_CHR[i]] = _CHR[i]
+ }
+ for (; i < 256; i++) {
+ _QSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
+ }
+ _QSTR["\\"] = "\\\\"
+ #; _QSTR["\""]="\\\""
+ #_____________________________________________________________________________
+
+ _CHR["CR"] = "\r"
+ _CHR["EOL"] = "\r\n"
+ _CHR["EOF"] = "\032"
+ _QSTR[_CHR["EOL"]] = "\\015\\012"
+ #_______________________________________________________________________
+
+ _CHR["MONTH"][_CHR["MONTH"]["Jan"] = "01"] = "Jan"
+ _CHR["MONTH"][_CHR["MONTH"]["Feb"] = "02"] = "Feb"
+ _CHR["MONTH"][_CHR["MONTH"]["Mar"] = "03"] = "Mar"
+ _CHR["MONTH"][_CHR["MONTH"]["Apr"] = "04"] = "Apr"
+ _CHR["MONTH"][_CHR["MONTH"]["May"] = "05"] = "May"
+ _CHR["MONTH"][_CHR["MONTH"]["Jun"] = "06"] = "Jun"
+ _CHR["MONTH"][_CHR["MONTH"]["Jul"] = "07"] = "Jul"
+ _CHR["MONTH"][_CHR["MONTH"]["Aug"] = "08"] = "Aug"
+ _CHR["MONTH"][_CHR["MONTH"]["Sep"] = "09"] = "Sep"
+ _CHR["MONTH"][_CHR["MONTH"]["Oct"] = "10"] = "Oct"
+ _CHR["MONTH"][_CHR["MONTH"]["Nov"] = "11"] = "Nov"
+ _CHR["MONTH"][_CHR["MONTH"]["Dec"] = "12"] = "Dec"
+ #_____________________________________________________________________________
+
+ _TAB_STEP_DEFAULT = 8
+ #_____________________________________________________________________________
+
+ for (i = 0; i < 32; i++) {
+ _REXPSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
+ }
+ for (; i < 256; i++) {
+ _REXPSTR[_CHR[i]] = _CHR[i]
+ }
+ _gensubfn("\\^$.()|{,}[-]?+*", ".", "_rexpstr_i0")
+}
+
+BEGIN {
+ _addlib("_SYSIO")
+}
+
+#############################################################################
+
+BEGIN {
+ _SYS_STDCON = "CON"
+ _CON_WIDTH = (match(_cmd("MODE " _SYS_STDCON " 2>NUL"), /Columns:[ \t]*([0-9]+)/, A) ? strtonum(A[1]) : 80)
+}
+
+BEGIN {
+ _addlib("_FILEIO")
+}
+
+#############################################################################
+
+BEGIN {
+ if (_SYS_STDOUT == "") {
+ _SYS_STDOUT = "/dev/stdout"
+ }
+ if (_SYS_STDERR == "") {
+ _SYS_STDERR = "/dev/stderr"
+ }
+ _CHR["SUBDIR"] = "\\"
+ if (_gawk_scriptlevel < 1) {
+ match(b = _cmd("echo %CD% 2>NUL"), /[^\x00-\x1F]*/)
+ ENVIRON["CD"] = _FILEIO_RD = _filerd(substr(b, RSTART, RLENGTH) _CHR["SUBDIR"])
+ _FILEIO_R = _filer(_FILEIO_RD)
+ _FILEIO_D = _filed(_FILEIO_RD)
+ _setmpath(_filerd(_FILEIO_RD "_tmp" _CHR["SUBDIR"]))
+ }
+}
+
+BEGIN {
+ _addlib("_tOBJ")
+}
+
+#############################################################################
+BEGIN {
+ _tInBy = "\212._tInBy"
+ _tgenuid_init()
+ _UIDS[""]
+ delete _UIDS[""]
+ _UIDSDEL[""]
+ delete _UIDSDEL[""]
+ _tPREV[""]
+ _tPARENT[""]
+ _tNEXT[""]
+ _tFCHLD[""]
+ _tQCHLD[""]
+ _tLCHLD[""]
+ _tLINK[""]
+ _tCLASS[""]
+ _tSTR[""]
+ _tDLINK[""]
+ _[""]
+ delete _[""]
+ _ptr[""]
+ delete _ptr[""]
+ _TMP0[""]
+ delete _TMP0[""]
+ _TMP1[""]
+ delete _TMP1[""]
+}
+
+BEGIN {
+ _addlib("_ERRLOG")
+}
+
+#############################################################################
+
+BEGIN {
+ if (_gawk_scriptlevel < 1) {
+ _ERRLOG_TF = 1
+ _ERRLOG_VF = 1
+ _ERRLOG_IF = 1
+ _ERRLOG_WF = 1
+ _ERRLOG_EF = 1
+ _ERRLOG_FF = 1
+ _wrfile(_errlog_file = _getmpfile("OUTPUT.LOG"), "")
+ }
+}
+
+BEGIN {
+ _addlib("_SHORTCUT")
+}
+
+#___________________________________________________________________________________
+BEGIN {
+ _shortcut_init()
+}
+
+#########################################################
+
+
+
+BEGIN {
+ _addlib("_eXTFN")
+}
+
+#___________________________________________________________________________________
+BEGIN {
+ _extfn_init()
+}
+
+############################################################
+
+
+BEGIN {
+ _addlib("_sHARE")
+}
+
+BEGIN {
+ _addlib("_FILEVER")
+}
+
+BEGIN {
+ _addlib("_DS")
+ ###############################################################################
+
+ _PRODUCT_NAME = "Deployment Solution Control"
+ _PRODUCT_VERSION = "1.0"
+ _PRODUCT_COPYRIGHT = "Copyright (C) 2013 by CosumoGEN"
+ _PRODUCT_FILENAME = "_main.ewk"
+}
+
+# problem configuring uid by array charset: i can' understand what format of the array: possibly - remove array support
+# after removal of array format detection: there is unfinished conflicts: it is possible to totally remove array uid-gen initialization
+
+#_____________________________________________________
+BEGIN {
+ _inituidefault()
+}
+
+#_____________________________________________________
+BEGIN {
+ _initfilever()
+}
+
+#_____________________________________________________
+BEGIN {
+ _initshare()
+}
+
+#_________________________________________________________________
+BEGIN {
+ _inspass(_IMPORT, "_import_data")
+}
+
+#_______________________________________________
+BEGIN {
+ _TEND[_ARRLEN] = 0
+ _TYPEWORD = "_TYPE"
+}
+
+#_______________________________________________
+BEGIN {
+ _ARRLEN = "\032LEN"
+ _ARRPTR = "\032PTR"
+ _ARRSTR = ""
+}
+
+#_____________________________________________________
+BEGIN {
+ _getperf_fn = "_nop"
+}
+
+BEGIN {
+ _datablock_length = 262144
+}
+
+#_____________________________________________________
+BEGIN {
+ _initrdreg()
+}
+
+#_____________________________________________________
+BEGIN {
+ _initregpath0()
+}
- BEGIN {
- _addlib("_BASE")
- }
+#_____________________________________________________
+BEGIN {
+ _initsys()
+}
- BEGIN {
- BINMODE = "rw"
- SUBSEP = "\000"
- _NULARR[""]
- delete _NULARR[""]
- _INITBASE()
- }
-
- BEGIN {
- _addlib("_sYS")
+############################################################################
+
+BEGIN {
+ a = ENVIRON["EGAWK_CMDLINE"]
+ gsub(/^[ \t]*/, "", a)
+ a = _lib_CMDLN(a)
+ if (a != "" && ! _LIBAPI["F"]["!"]) {
+ _out(_lib_HELP())
+ _fatal("Bad comandline argument `" a "'")
+ }
+ gsub(/^[ \t]*/, "", a)
+ ENVIRON["EGAWK_CMDLINE"] = a
+ _lib_APPLY()
+ if (_basexit_fl) {
+ exit
+ }
+ _INIT()
+ _START()
+ _END()
+}
+
+########################################################################
+
+END {
+ _EXIT()
+}
+
+###############################################################################
+
+END {
+ if (_gawk_scriptlevel < 1) {
+ close(_errlog_file)
+ p = _Zimport(_rdfile(_errlog_file), _N())
+ if ((t = _get_errout(p)) != "") {
+ _expout(t, "/dev/stderr")
+ }
+ }
+}
+
+###############################################################################
+
+END {
+ if (_gawk_scriptlevel < 1) {
+ if (! _fileio_notdeltmpflag) {
+ _FILEIO_TMPATHS[_FILEIO_TMPRD]
+ _Foreach(_FILEIO_TMPATHS, "_uninit_del")
+ }
+ }
+}
+
+###############################################################################
+END {
+ if (_constatstrln > 0) {
+ _constat()
}
+}
- BEGIN {
- _addlib("_rEG")
- }
+#___________________________________________________________________________________
+####################################################################################
- BEGIN {
- _addlib("_INSTRUC")
- }
- BEGIN {
- _delay_perfmsdelay = 11500
- }
- BEGIN {
- _addlib("_ARR")
- }
- BEGIN {
- }
- BEGIN {
- _addlib("_EXTFN")
- }
- BEGIN {
- delete _XCHR
- delete _ASC
- delete _CHR
- t = ""
- for (i = 0; i < 256; i++) {
- _ASC[a = _CHR[i] = sprintf("%c", i)] = i
- _QASC[a] = sprintf("%.3o", i)
- _XCHR[_CHR[i]] = sprintf("%c", (i < 128 ? i + 128 : i - 128))
- }
- for (i = 0; i < 256; i++) {
- _QSTRQ[_CHR[i]] = "\\" sprintf("%.3o", i)
- }
- for (i = 0; i < 32; i++) {
- _QSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
- }
- for (; i < 128; i++) {
- _QSTR[_CHR[i]] = _CHR[i]
- }
- for (; i < 256; i++) {
- _QSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
- }
- _QSTR["\\"] = "\\\\"
- _CHR["CR"] = "\r"
- _CHR["EOL"] = "\r\n"
- _CHR["EOF"] = "\032"
- _QSTR[_CHR["EOL"]] = "\\015\\012"
- _CHR["MONTH"][_CHR["MONTH"]["Jan"] = "01"] = "Jan"
- _CHR["MONTH"][_CHR["MONTH"]["Feb"] = "02"] = "Feb"
- _CHR["MONTH"][_CHR["MONTH"]["Mar"] = "03"] = "Mar"
- _CHR["MONTH"][_CHR["MONTH"]["Apr"] = "04"] = "Apr"
- _CHR["MONTH"][_CHR["MONTH"]["May"] = "05"] = "May"
- _CHR["MONTH"][_CHR["MONTH"]["Jun"] = "06"] = "Jun"
- _CHR["MONTH"][_CHR["MONTH"]["Jul"] = "07"] = "Jul"
- _CHR["MONTH"][_CHR["MONTH"]["Aug"] = "08"] = "Aug"
- _CHR["MONTH"][_CHR["MONTH"]["Sep"] = "09"] = "Sep"
- _CHR["MONTH"][_CHR["MONTH"]["Oct"] = "10"] = "Oct"
- _CHR["MONTH"][_CHR["MONTH"]["Nov"] = "11"] = "Nov"
- _CHR["MONTH"][_CHR["MONTH"]["Dec"] = "12"] = "Dec"
- _TAB_STEP_DEFAULT = 8
- for (i = 0; i < 32; i++) {
- _REXPSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
- }
- for (; i < 256; i++) {
- _REXPSTR[_CHR[i]] = _CHR[i]
- }
- _gensubfn("\\^$.()|{,}[-]?+*", ".", "_rexpstr_i0")
- }
- BEGIN {
- _addlib("_SYSIO")
- }
+# make sure that stdout contain only expected characters
+# make sure that stderr contain only expected characters
+# redesign & reformat keys and its outputs
+# try different key combinations
+# add lib-specified to all libs
- BEGIN {
- _SYS_STDCON = "CON"
- _CON_WIDTH = (match(_cmd("MODE " _SYS_STDCON " 2>NUL"), /Columns:[ \t]*([0-9]+)/, A) ? strtonum(A[1]) : 80)
- }
- BEGIN {
- _addlib("_FILEIO")
- }
-
- BEGIN {
- if (_SYS_STDOUT == "") {
- _SYS_STDOUT = "/dev/stdout"
- }
- if (_SYS_STDERR == "") {
- _SYS_STDERR = "/dev/stderr"
- }
- _CHR["SUBDIR"] = "\\"
- if (_gawk_scriptlevel < 1) {
- match(b = _cmd("echo %CD% 2>NUL"), /[^\x00-\x1F]*/)
- ENVIRON["CD"] = _FILEIO_RD = _filerd(substr(b, RSTART, RLENGTH) _CHR["SUBDIR"])
- _FILEIO_R = _filer(_FILEIO_RD)
- _FILEIO_D = _filed(_FILEIO_RD)
- _setmpath(_filerd(_FILEIO_RD "_tmp" _CHR["SUBDIR"]))
+#_______________________________________________________________________
+function W(p, p0, p1)
+{
+ #####################################################
+ if (isarray(p0)) {
+ delete p0[p]
+ if (isarray(p1)) {
+ for (i in p1) {
+ if (isarray(p1[i])) {
+ p0[p][i][""]
+ delete p0[p][i][""]
+ _N_i0(p0[p][i], p1[i])
+ } else {
+ p0[p][i] = p1[i]
+ }
+ }
+ return p
}
+ return (p0[p] = p1)
}
-
- BEGIN {
- _addlib("_tOBJ")
- }
-
- BEGIN {
- _tInBy = "\212._tInBy"
- _tgenuid_init()
- _UIDS[""]
- delete _UIDS[""]
- _UIDSDEL[""]
- delete _UIDSDEL[""]
- _tPREV[""]
- _tPARENT[""]
- _tNEXT[""]
- _tFCHLD[""]
- _tQCHLD[""]
- _tLCHLD[""]
- _tLINK[""]
- _tCLASS[""]
- _tSTR[""]
- _tDLINK[""]
- _[""]
- delete _[""]
- _ptr[""]
- delete _ptr[""]
- _TMP0[""]
- delete _TMP0[""]
- _TMP1[""]
- delete _TMP1[""]
- }
-
- BEGIN {
- _addlib("_ERRLOG")
- }
-
- BEGIN {
- if (_gawk_scriptlevel < 1) {
- _ERRLOG_TF = 1
- _ERRLOG_VF = 1
- _ERRLOG_IF = 1
- _ERRLOG_WF = 1
- _ERRLOG_EF = 1
- _ERRLOG_FF = 1
- _wrfile(_errlog_file = _getmpfile("OUTPUT.LOG"), "")
+ delete _[p][p0]
+ if (isarray(p1)) {
+ for (i in p1) {
+ if (isarray(p1[i])) {
+ _[p][p0][i][""]
+ delete _[p][p0][i][""]
+ _N_i0(_[p][p0][i], p1[i])
+ } else {
+ _[p][p0][i] = p1[i]
+ }
}
+ return p
}
+ return (_[p][p0] = p1)
+}
- BEGIN {
- _addlib("_SHORTCUT")
- }
-
- BEGIN {
- _shortcut_init()
- }
-
- BEGIN {
- _addlib("_eXTFN")
- }
-
- BEGIN {
- _extfn_init()
- }
-
- BEGIN {
- _addlib("_sHARE")
- }
-
- BEGIN {
- _addlib("_FILEVER")
- }
-
- BEGIN {
- _addlib("_DS")
- _PRODUCT_NAME = "Deployment Solution Control"
- _PRODUCT_VERSION = "1.0"
- _PRODUCT_COPYRIGHT = "Copyright (C) 2013 by CosumoGEN"
- _PRODUCT_FILENAME = "_main.ewk"
- }
-
- BEGIN {
- _inituidefault()
- }
-
- BEGIN {
- _initfilever()
- }
-
- BEGIN {
- _initshare()
- }
-
- BEGIN {
- _inspass(_IMPORT, "_import_data")
- }
-
- BEGIN {
- _TEND[_ARRLEN] = 0
- _TYPEWORD = "_TYPE"
- }
-
- BEGIN {
- _ARRLEN = "\032LEN"
- _ARRPTR = "\032PTR"
- _ARRSTR = ""
- }
-
- BEGIN {
- _getperf_fn = "_nop"
- }
-
- BEGIN {
- _datablock_length = 262144
- }
-
- BEGIN {
- _initrdreg()
- }
-
- BEGIN {
- _initregpath0()
- }
-
- BEGIN {
- _initsys()
- }
+##########################################################
- BEGIN {
- a = ENVIRON["EGAWK_CMDLINE"]
- gsub(/^[ \t]*/, "", a)
- a = _lib_CMDLN(a)
- if (a != "" && ! _LIBAPI["F"]["!"]) {
- _out(_lib_HELP())
- _fatal("Bad comandline argument `" a "'")
- }
- gsub(/^[ \t]*/, "", a)
- ENVIRON["EGAWK_CMDLINE"] = a
- _lib_APPLY()
- if (_basexit_fl) {
- exit
- }
- _INIT()
- _START()
- _END()
+function _ARR(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
+ return
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_ARR 1.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
+ return
}
+}
- # END block(s)
+##########################################################
- END {
- _EXIT()
- }
-
- END {
- if (_gawk_scriptlevel < 1) {
- close(_errlog_file)
- p = _Zimport(_rdfile(_errlog_file), _N())
- if ((t = _get_errout(p)) != "") {
- _expout(t, "/dev/stderr")
+function _BASE(c, t, P, A)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ if (match(t, /^((--([Vv])ersion)|(-([Vv])))[ \t]*/, A)) {
+ t = substr(t, RLENGTH + 1)
+ _cmdln_version = A[3] A[5]
+ } else {
+ if (match(t, /^((-?\?)|(--help))[ \t]*/)) {
+ t = substr(t, RLENGTH + 1)
+ _cmdln_help = 1
+ } else {
+ if (match(t, /^--[ \t]*/)) {
+ return _endpass(substr(t, RLENGTH + 1))
+ }
}
}
- }
-
- END {
- if (_gawk_scriptlevel < 1) {
- if (! _fileio_notdeltmpflag) {
- _FILEIO_TMPATHS[_FILEIO_TMPRD]
- _Foreach(_FILEIO_TMPATHS, "_uninit_del")
- }
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
+ if (_cmdln_help) {
+ match(_fbaccr(_LIBAPI, "_lib_HELP"), /^([^\x00]*)\x00([^\x01]*)\x01(.*)/, A)
+ _out(A[2] A[1] A[3])
+ return _endpass(_basexit_fl = 1)
+ }
+ if (_cmdln_version) {
+ _out(_ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() ((_cmdln_version == "v" ? "" : _lib_NAMEVER())))
+ return _endpass(_basexit_fl = 1)
}
+ return
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return ("\000" _ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() _ln(" Usage:") _ln() _ln(" " _PRODUCT_FILENAME " [/key1 /key2...] [-- cmdline]") _ln() _ln(" keys:") _ln() "\001" _ln(" -v -V --version - output product version and (if /V) all modules") _ln(" ? -? --help - output this help page") _ln(" -- - command line string edge"))
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_BASE 3.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
+ return
}
+}
- END {
- if (_constatstrln > 0) {
- _constat()
- }
+#____________________________________________________________________________
+function _DS(c, t, P, a, A)
+{
+ ######################################################
+ switch (c) {
+ case "_lib_CMDLN":
+ #___________________________________________________________
+ return t
+ #_____________________________________________________
+ case "_lib_APPLY":
+ return
+ #_____________________________________________________
+ case "_lib_HELP":
+ return (_ln() _ln(" Usage: " _PRODUCT_NAME " [/key1 /key2...] sourcefile [cmdline]") _ln())
+ #_____________________________________________________
+ case "_lib_NAMEVER":
+ return
+ #_____________________________________________________
+ case "_lib_BEGIN":
+ return
+ #_____________________________________________________
+ case "_lib_END":
+ return
}
+}
+#______________________________________________________________________________________________
+function _END()
+{
+ #################################################################################
+
+}
- # Functions, listed alphabetically
+########################################################
- function W(p, p0, p1)
- {
- if (isarray(p0)) {
- delete p0[p]
- if (isarray(p1)) {
- for (i in p1) {
- if (isarray(p1[i])) {
- p0[p][i][""]
- delete p0[p][i][""]
- _N_i0(p0[p][i], p1[i])
- } else {
- p0[p][i] = p1[i]
- }
- }
- return p
- }
- return (p0[p] = p1)
+function _ERRLOG(c, t, P, a, b, A)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ if (match(t, /^[ \t]*-L:([TtVvIiWwEeFf]*)[ \t]*/, A)) {
+ t = substr(t, RLENGTH + 1)
+ _errlog_errflkey = _errlog_errflkey A[1]
}
- delete _[p][p0]
- if (isarray(p1)) {
- for (i in p1) {
- if (isarray(p1[i])) {
- _[p][p0][i][""]
- delete _[p][p0][i][""]
- _N_i0(_[p][p0][i], p1[i])
+ return t
+ #_______________________________________________________________________
+
+ case "_lib_APPLY":
+ if (_errlog_errflkey) {
+ split(_errlog_errflkey, A, "")
+ for (a = 1; a in A; a++) {
+ if (A[a] == toupper(A[a])) {
+ b = 1
} else {
- _[p][p0][i] = p1[i]
+ b = ""
+ }
+ switch (toupper(A[a])) {
+ case "T":
+ _ERRLOG_TF = b
+ break
+ case "V":
+ _ERRLOG_VF = b
+ break
+ case "I":
+ _ERRLOG_IF = b
+ break
+ case "W":
+ _ERRLOG_WF = b
+ break
+ case "E":
+ _ERRLOG_EF = b
+ break
+ case "F":
+ _ERRLOG_FF = b
+ break
}
}
- return p
+ if (_ERRLOG_IF) {
+ _info("Log-message types inherited acc/deny: " "TRACE " ((_ERRLOG_TF ? "ON" : "OFF")) "/" "VERBOSE " ((_ERRLOG_VF ? "ON" : "OFF")) "/" "INFO " ((_ERRLOG_IF ? "ON" : "OFF")) "/" "WARNING " ((_ERRLOG_WF ? "ON" : "OFF")) "/" "ERROR " ((_ERRLOG_EF ? "ON" : "OFF")) "/" "FATAL " ((_ERRLOG_FF ? "ON" : "OFF")))
+ }
}
- return (_[p][p0] = p1)
+ return
+ #_______________________________________________________________________
+
+ case "_lib_HELP":
+ return (_ln(" -L:TtVvIiWwEeFf - enable(upcase: TVIWEF) or disable(lowcase: tviwef) allowable type of") _ln(" log messages. Trace/Verbose/Informational/Warning/Error/Fatal.") _ln())
+ #_______________________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_ERRLOG 1.0")
+ #_______________________________________________________________________
+
+ case "_lib_BEGIN":
+ P["_ERRLOG_TF"] = _ERRLOG_TF
+ P["_ERRLOG_VF"] = _ERRLOG_VF
+ P["_ERRLOG_IF"] = _ERRLOG_IF
+ P["_ERRLOG_WF"] = _ERRLOG_WF
+ P["_ERRLOG_EF"] = _ERRLOG_EF
+ P["_ERRLOG_FF"] = _ERRLOG_FF
+ P["_errlog_file"] = "/dev/stderr"
+ return
}
+}
- function _ARR(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_ARR 1.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
+#______________________________________________________________________________________________
+function _EXIT()
+{
+ ################################################################################
+
+}
+
+########################################################
+
+function _EXTFN(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
+ return
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_EXTFN 1.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
+ return
}
+}
- function _BASE(c, t, P, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- if (match(t, /^((--([Vv])ersion)|(-([Vv])))[ \t]*/, A)) {
- t = substr(t, RLENGTH + 1)
- _cmdln_version = A[3] A[5]
+#######################################################
+
+function _FILEIO(c, t, P, A)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ if (match(t, /^[ \t]*-[Tt]([\+-])[ \t]*/, A)) {
+ t = substr(t, RLENGTH + 1)
+ if (A[1] == "+") {
+ _fileio_notdeltmpflag = 1
} else {
- if (match(t, /^((-?\?)|(--help))[ \t]*/)) {
- t = substr(t, RLENGTH + 1)
- _cmdln_help = 1
- } else {
- if (match(t, /^--[ \t]*/)) {
- return _endpass(substr(t, RLENGTH + 1))
- }
- }
- }
- return t
- case "_lib_APPLY":
- if (_cmdln_help) {
- match(_fbaccr(_LIBAPI, "_lib_HELP"), /^([^\x00]*)\x00([^\x01]*)\x01(.*)/, A)
- _out(A[2] A[1] A[3])
- return _endpass(_basexit_fl = 1)
+ _fileio_notdeltmpflag = ""
}
- if (_cmdln_version) {
- _out(_ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() ((_cmdln_version == "v" ? "" : _lib_NAMEVER())))
- return _endpass(_basexit_fl = 1)
- }
- return
- case "_lib_HELP":
- return ("\000" _ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() _ln(" Usage:") _ln() _ln(" " _PRODUCT_FILENAME " [/key1 /key2...] [-- cmdline]") _ln() _ln(" keys:") _ln() "\001" _ln(" -v -V --version - output product version and (if /V) all modules") _ln(" ? -? --help - output this help page") _ln(" -- - command line string edge"))
- case "_lib_NAMEVER":
- return _ln("_BASE 3.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
}
- }
-
- function _DS(c, t, P, a, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return (_ln() _ln(" Usage: " _PRODUCT_NAME " [/key1 /key2...] sourcefile [cmdline]") _ln())
- case "_lib_NAMEVER":
- return
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
+ if (_fileio_notdeltmpflag) {
+ _info("Temporary objects deletion DISABLED (inherited)")
+ }
+ return
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return (_ln(" -[Tt][+-] - inherited: +enable\\-disable temporary files\\dirs deletion") _ln())
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_FILEIO 2.1")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ P["ENVIRON"]["CD"] = ENVIRON["CD"]
+ P["_FILEIO_RD"] = _FILEIO_RD
+ P["_FILEIO_R"] = _FILEIO_R
+ P["_FILEIO_D"] = _FILEIO_D
+ if (! ("_FILEIO_TMPRD" in P)) {
+ P["_FILEIO_TMPRD"] = _getmpdir(_filen(P["SOURCE"]) "." ++_egawk_subcntr _CHR["SUBDIR"])
}
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
+ return
}
+}
- function _END()
- {
+############################################################
+#_____________________________________________________________________________
+function _FILEVER(c, t, P, a, A)
+{
+ #################################################
+ switch (c) {
+ case "_lib_CMDLN":
+ #___________________________________________________________
+ return t
+ #_____________________________________________________
+ case "_lib_APPLY":
+ return
+ #_____________________________________________________
+ case "_lib_HELP":
+ return
+ #_____________________________________________________
+ case "_lib_NAMEVER":
+ return
+ #_____________________________________________________
+ case "_lib_BEGIN":
+ return
+ #_____________________________________________________
+ case "_lib_END":
+ return
}
+}
- function _ERRLOG(c, t, P, a, b, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- if (match(t, /^[ \t]*-L:([TtVvIiWwEeFf]*)[ \t]*/, A)) {
- t = substr(t, RLENGTH + 1)
- _errlog_errflkey = _errlog_errflkey A[1]
- }
- return t
- case "_lib_APPLY":
- if (_errlog_errflkey) {
- split(_errlog_errflkey, A, "")
- for (a = 1; a in A; a++) {
- if (A[a] == toupper(A[a])) {
- b = 1
- } else {
- b = ""
- }
- switch (toupper(A[a])) {
- case "T":
- _ERRLOG_TF = b
- break
- case "V":
- _ERRLOG_VF = b
- break
- case "I":
- _ERRLOG_IF = b
- break
- case "W":
- _ERRLOG_WF = b
- break
- case "E":
- _ERRLOG_EF = b
- break
- case "F":
- _ERRLOG_FF = b
- break
- }
- }
- if (_ERRLOG_IF) {
- _info("Log-message types inherited acc/deny: " "TRACE " ((_ERRLOG_TF ? "ON" : "OFF")) "/" "VERBOSE " ((_ERRLOG_VF ? "ON" : "OFF")) "/" "INFO " ((_ERRLOG_IF ? "ON" : "OFF")) "/" "WARNING " ((_ERRLOG_WF ? "ON" : "OFF")) "/" "ERROR " ((_ERRLOG_EF ? "ON" : "OFF")) "/" "FATAL " ((_ERRLOG_FF ? "ON" : "OFF")))
- }
- }
- return
- case "_lib_HELP":
- return (_ln(" -L:TtVvIiWwEeFf - enable(upcase: TVIWEF) or disable(lowcase: tviwef) allowable type of") _ln(" log messages. Trace/Verbose/Informational/Warning/Error/Fatal.") _ln())
- case "_lib_NAMEVER":
- return _ln("_ERRLOG 1.0")
- case "_lib_BEGIN":
- P["_ERRLOG_TF"] = _ERRLOG_TF
- P["_ERRLOG_VF"] = _ERRLOG_VF
- P["_ERRLOG_IF"] = _ERRLOG_IF
- P["_ERRLOG_WF"] = _ERRLOG_WF
- P["_ERRLOG_EF"] = _ERRLOG_EF
- P["_ERRLOG_FF"] = _ERRLOG_FF
- P["_errlog_file"] = "/dev/stderr"
- return
- }
+function _Foreach(A, f, p0, i)
+{
+ for (i in A) {
+ @f(A, i, p0)
}
+}
- function _EXIT()
- {
- }
+function _INIT(f)
+{
+}
- function _EXTFN(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_EXTFN 1.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
- }
+#___________________________________________________________________________________
+function _INITBASE()
+{
+ ################################################################
+
+ _egawk_utilpath = ENVIRON["EGAWK_PATH"] "BIN\\UTIL\\"
+}
- function _FILEIO(c, t, P, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- if (match(t, /^[ \t]*-[Tt]([\+-])[ \t]*/, A)) {
- t = substr(t, RLENGTH + 1)
- if (A[1] == "+") {
- _fileio_notdeltmpflag = 1
- } else {
- _fileio_notdeltmpflag = ""
- }
- }
- return t
- case "_lib_APPLY":
- if (_fileio_notdeltmpflag) {
- _info("Temporary objects deletion DISABLED (inherited)")
- }
- return
- case "_lib_HELP":
- return (_ln(" -[Tt][+-] - inherited: +enable\\-disable temporary files\\dirs deletion") _ln())
- case "_lib_NAMEVER":
- return _ln("_FILEIO 2.1")
- case "_lib_BEGIN":
- P["ENVIRON"]["CD"] = ENVIRON["CD"]
- P["_FILEIO_RD"] = _FILEIO_RD
- P["_FILEIO_R"] = _FILEIO_R
- P["_FILEIO_D"] = _FILEIO_D
- if (! ("_FILEIO_TMPRD" in P)) {
- P["_FILEIO_TMPRD"] = _getmpdir(_filen(P["SOURCE"]) "." ++_egawk_subcntr _CHR["SUBDIR"])
- }
- return
- case "_lib_END":
- return
- }
- }
+######################################################
- function _FILEVER(c, t, P, a, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
+function _INSTRUC(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
+ return
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_INSTRUC 1.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
+ return
}
+}
- function _Foreach(A, f, p0, i)
- {
- for (i in A) {
- @f(A, i, p0)
- }
- }
+#___________________________________________________________________________________
- function _INIT(f)
- {
- }
- function _INITBASE()
- {
- _egawk_utilpath = ENVIRON["EGAWK_PATH"] "BIN\\UTIL\\"
- }
+####################################################################################
- function _INSTRUC(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_INSTRUC 1.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
- }
- function _N(F, v, p)
- {
- for (p in _UIDS) {
- delete _UIDS[p]
- return _nN_i0(p, F, v)
- }
- return _nN_i0(_tgenuid(), F, v)
+#_____________________________________________________________________________
+function _N(F, v, p)
+{
+ ###########################################################
+ for (p in _UIDS) {
+ delete _UIDS[p]
+ return _nN_i0(p, F, v)
}
+ return _nN_i0(_tgenuid(), F, v)
+}
- function _SHORTCUT(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_shortcut 1.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
- }
+#####################################################
- function _START(t, i, A)
- {
- _torexp_init()
- test_uid()
+function _SHORTCUT(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
return
- _conl(patsplit("a,b,c", A, /[^,]/, B))
- test_splitstr()
+ #___________________________________________________________
+
+ case "_lib_HELP":
return
- A[""]
- _CLASSPTR["ptr"]
- ALTARR["ptra"]
- _conl(_dumparr(SYMTAB))
- BB[1] = _NOP
- zorr(1, 2, 3, 4, 5, 6)
- zorr(BB, 1)
- _rtn()
- _rtn("")
- _rtn(0)
- _rtn("0")
- _rtn(1)
- _rtn("1")
- _rtn(-1)
- _rtn("-1")
- _rtn("huj")
- _rtn("ptr")
- _rtn("ptra", ALTARR)
- _rtn(ALTARR)
- _rtn(ALTARR, ALTARR)
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_shortcut 1.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
return
- _tstini()
+ #___________________________________________________________
+
+ case "_lib_END":
return
- _splitpath_test()
+ }
+}
+
+#______________________________________________________________________________________________
+function _START(t, i, A)
+{
+ #########################################################################
+ _torexp_init()
+ test_uid()
+ return
+ _conl(patsplit("a,b,c", A, /[^,]/, B))
+ test_splitstr()
+ return
+ A[""]
+ _CLASSPTR["ptr"]
+ ALTARR["ptra"]
+ _conl(_dumparr(SYMTAB))
+ BB[1] = _NOP
+ zorr(1, 2, 3, 4, 5, 6)
+ zorr(BB, 1)
+ _rtn()
+ _rtn("")
+ _rtn(0)
+ _rtn("0")
+ _rtn(1)
+ _rtn("1")
+ _rtn(-1)
+ _rtn("-1")
+ _rtn("huj")
+ _rtn("ptr")
+ _rtn("ptra", ALTARR)
+ _rtn(ALTARR)
+ _rtn(ALTARR, ALTARR)
+ return
+ _tstini()
+ return
+ _splitpath_test()
+ # _split_regpath()
+ return
+ hh = "CPU"
+ _conl("go1!")
+ _conl(_var(_sharepath(hh, "gdfsgdsgsd sdgsdighjui teretiewrotrewut 345345345 rtjtireutireu huj")))
+ _conl("go2!")
+ _conl(_var(_sharelist(AAA, hh), _dumparr(AAA)))
+ _conline()
+ A[1] = "h"
+ A[3] = "j"
+ t = "pizda"
+ if (match(t, /^pi(Z)da/, A)) {
+ _conl("match")
+ } else {
+ _conl("not match")
+ }
+ _conl(_dumparr(A))
+ return
+ _pathSMA = "C:\\Program Files\\Altiris\\Altiris Agent\\"
+ DSPlugInPath = _pathSMA "Agents\\Deployment\\Agent\\"
+ DSAutoPath = _pathSMA
+ if (! _sysinfo(_SYS, _hostname)) {
+ _fatal("_sysinfo: unknown error")
+ }
+ _REG[""]
+ delete _REG[""]
+ _servoutput = _CHR["EOL"] _cmd("sc query state= all")
+ _dsbasepath = "\\\\CPU\\CPU\\DEV\\PROJECT\\_DS\\"
+ _rdreg(_REG, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris")
+ _wrfile("rego.txt", _dumparr(_REG))
+ _conl("fF")
+ #_______________________________________________________________________
+
+ c = _getreg_i1(DDD, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\\204~.*\224Install path", _REG)
+ #_________________________________________________________________________________________
+ pp = _n("NAME", "NS")
+ #pp=_n()
+ #___________________________________________________________________________________
+ p = _defsolution(pp, "DS Plug-in", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\Agents\\")
+ ClientConfiguration = _defdll(p, "Client Configuration", "ClientConfiguration")
+ ClientImagingPrep = _defdll(p, "Client Inaging Preparation", "ClientImagingPrep")
+ ClientImaging = _defdll(p, "Client Imaging", "ClientImaging")
+ ClientPCT = _defdll(p, "Client PCT", "ClientPCT")
+ ClientRebootTo = _defdll(p, "Client Reboot To", "ClientRebootTo")
+ DeploymentAgent = _defdll(p, "Deployment Agent", "Deployment Agent")
+ DeploymentSolutionBaseAgent = _defdll(p, "Deployment Solution Base Agent", "Deployment Solution Base Agent")
+ ClientBCDEdit = _defile(p, "Client BCD Edit", "ClientBCDEdit.dll")
+ ClientCopyFile = _defile(p, "Client Copy File", "ClientCopyFile.dll")
+ ClientPreImage = _defile(p, "Client Pre Image", "ClientPreImage.dll")
+ ClientRebootTo = _defile(p, "Client Reboot To", "ClientRebootTo.dll")
+ _defile(p, "ConfigService.exe", "ConfigService.exe", "")
+ _defile(p, "config.dll", "config.dll", "")
+ _defsrv(p, "DS Plug-in Service", "Altiris Deployment Solution - System Configuration")
+ _defreg(p, "Deployment Agent Path", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR")
+ _defile(p, "Altiris_DeploymentSolutionAgent_7_1_x86.msi", (_SYS["OSArchitecture"] == "64-bit" ? "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{9D76E4CA-377A-472D-A82E-EDAD77E7E4ED}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x64.msi" : "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{4B747D25-612F-48FC-B6B5-9916D1BB755C}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x86.msi"), "")
+ _defdir(p, "Deployment Folder", a = gensub(/[^\\]*$/, "", 1, _rdsafe(_REG, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR", "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\Deployment\\Agent\\")))
+ #___________________________________________________________________________________
+ p = _defsolution(pp, "DS Auto", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\Agents\\")
+ _defdir(p, "C:\\Boot\\Altiris\\iso\\boot\\fonts\\", "C:\\Boot\\Altiris\\iso\\boot\\fonts\\")
+ _defdir(p, "C:\\Boot\\Altiris\\iso\\sources\\", "C:\\Boot\\Altiris\\iso\\sources\\")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\autoinst.exe", "C:\\Boot\\Altiris\\iso\\autoinst.exe", "")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\autoinst.ini", "C:\\Boot\\Altiris\\iso\\autoinst.ini", "")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\autoutil.exe", "C:\\Boot\\Altiris\\iso\\autoutil.exe", "")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\autoutil.ini", "C:\\Boot\\Altiris\\iso\\autoutil.ini", "")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\bcdedit.exe", "C:\\Boot\\Altiris\\iso\\bcdedit.exe", "")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\bootmgr", "C:\\Boot\\Altiris\\iso\\bootmgr", "")
+ _defile(p, "C:\\Boot\\Altiris\\iso\\bootsect.exe", "C:\\Boot\\Altiris\\iso\\bootsect.exe", "")
+ _defreg(p, "Deployment Automation reg.File", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\AutoUtil\\File.XSZ", "autoutil.exe")
+ _defreg(p, "Deployment Automation reg.Path", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\AutoUtil\\Path.XSZ", "%systemdrive%\\boot\\altiris\\iso")
+ #_________________________________________________________________________________________
+
+ _check(pp)
+ #_________________________________________________________________________________________
+
+ _conl(_report(pp))
+ _wrfile("report.txt", _report(pp))
+}
+
+#########################################################
+
+function _SYSIO(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
return
- hh = "CPU"
- _conl("go1!")
- _conl(_var(_sharepath(hh, "gdfsgdsgsd sdgsdighjui teretiewrotrewut 345345345 rtjtireutireu huj")))
- _conl("go2!")
- _conl(_var(_sharelist(AAA, hh), _dumparr(AAA)))
- _conline()
- A[1] = "h"
- A[3] = "j"
- t = "pizda"
- if (match(t, /^pi(Z)da/, A)) {
- _conl("match")
- } else {
- _conl("not match")
- }
- _conl(_dumparr(A))
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_SYSIO 1.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
return
- _pathSMA = "C:\\Program Files\\Altiris\\Altiris Agent\\"
- DSPlugInPath = _pathSMA "Agents\\Deployment\\Agent\\"
- DSAutoPath = _pathSMA
- if (! _sysinfo(_SYS, _hostname)) {
- _fatal("_sysinfo: unknown error")
- }
- _REG[""]
- delete _REG[""]
- _servoutput = _CHR["EOL"] _cmd("sc query state= all")
- _dsbasepath = "\\\\CPU\\CPU\\DEV\\PROJECT\\_DS\\"
- _rdreg(_REG, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris")
- _wrfile("rego.txt", _dumparr(_REG))
- _conl("fF")
- c = _getreg_i1(DDD, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\\204~.*\224Install path", _REG)
- pp = _n("NAME", "NS")
- p = _defsolution(pp, "DS Plug-in", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\Agents\\")
- ClientConfiguration = _defdll(p, "Client Configuration", "ClientConfiguration")
- ClientImagingPrep = _defdll(p, "Client Inaging Preparation", "ClientImagingPrep")
- ClientImaging = _defdll(p, "Client Imaging", "ClientImaging")
- ClientPCT = _defdll(p, "Client PCT", "ClientPCT")
- ClientRebootTo = _defdll(p, "Client Reboot To", "ClientRebootTo")
- DeploymentAgent = _defdll(p, "Deployment Agent", "Deployment Agent")
- DeploymentSolutionBaseAgent = _defdll(p, "Deployment Solution Base Agent", "Deployment Solution Base Agent")
- ClientBCDEdit = _defile(p, "Client BCD Edit", "ClientBCDEdit.dll")
- ClientCopyFile = _defile(p, "Client Copy File", "ClientCopyFile.dll")
- ClientPreImage = _defile(p, "Client Pre Image", "ClientPreImage.dll")
- ClientRebootTo = _defile(p, "Client Reboot To", "ClientRebootTo.dll")
- _defile(p, "ConfigService.exe", "ConfigService.exe", "")
- _defile(p, "config.dll", "config.dll", "")
- _defsrv(p, "DS Plug-in Service", "Altiris Deployment Solution - System Configuration")
- _defreg(p, "Deployment Agent Path", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR")
- _defile(p, "Altiris_DeploymentSolutionAgent_7_1_x86.msi", (_SYS["OSArchitecture"] == "64-bit" ? "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{9D76E4CA-377A-472D-A82E-EDAD77E7E4ED}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x64.msi" : "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{4B747D25-612F-48FC-B6B5-9916D1BB755C}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x86.msi"), "")
- _defdir(p, "Deployment Folder", a = gensub(/[^\\]*$/, "", 1, _rdsafe(_REG, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR", "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\Deployment\\Agent\\")))
- p = _defsolution(pp, "DS Auto", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\Agents\\")
- _defdir(p, "C:\\Boot\\Altiris\\iso\\boot\\fonts\\", "C:\\Boot\\Altiris\\iso\\boot\\fonts\\")
- _defdir(p, "C:\\Boot\\Altiris\\iso\\sources\\", "C:\\Boot\\Altiris\\iso\\sources\\")
- _defile(p, "C:\\Boot\\Altiris\\iso\\autoinst.exe", "C:\\Boot\\Altiris\\iso\\autoinst.exe", "")
- _defile(p, "C:\\Boot\\Altiris\\iso\\autoinst.ini", "C:\\Boot\\Altiris\\iso\\autoinst.ini", "")
- _defile(p, "C:\\Boot\\Altiris\\iso\\autoutil.exe", "C:\\Boot\\Altiris\\iso\\autoutil.exe", "")
- _defile(p, "C:\\Boot\\Altiris\\iso\\autoutil.ini", "C:\\Boot\\Altiris\\iso\\autoutil.ini", "")
- _defile(p, "C:\\Boot\\Altiris\\iso\\bcdedit.exe", "C:\\Boot\\Altiris\\iso\\bcdedit.exe", "")
- _defile(p, "C:\\Boot\\Altiris\\iso\\bootmgr", "C:\\Boot\\Altiris\\iso\\bootmgr", "")
- _defile(p, "C:\\Boot\\Altiris\\iso\\bootsect.exe", "C:\\Boot\\Altiris\\iso\\bootsect.exe", "")
- _defreg(p, "Deployment Automation reg.File", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\AutoUtil\\File.XSZ", "autoutil.exe")
- _defreg(p, "Deployment Automation reg.Path", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\AutoUtil\\Path.XSZ", "%systemdrive%\\boot\\altiris\\iso")
- _check(pp)
- _conl(_report(pp))
- _wrfile("report.txt", _report(pp))
- }
-
- function _SYSIO(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_SYSIO 1.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
}
+}
- function _W(p, A, v)
- {
- if (isarray(v)) {
- if (p) {
- delete A[p]
- A[p][""]
- delete A[p][""]
- _movarr(A[p], v)
- }
- return p
- }
+#_______________________________________________________________________
+########################################################################
+
+
+function _W(p, A, v)
+{
+ if (isarray(v)) {
if (p) {
delete A[p]
- return (A[p] = v)
+ A[p][""]
+ delete A[p][""]
+ _movarr(A[p], v)
}
- return v
+ return p
}
-
- function _Zexparr(S, s, t, i)
- {
- t = ""
- if (isarray(S)) {
- for (i in S) {
- t = t ((isarray(S[i]) ? _Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020" : _Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020"))
- }
- }
- if (s != "") {
- gsub(/\x1B/, "\033;", s)
- gsub(/\x10/, "\0330", s)
- t = t "\021\021\020" s
- }
- gsub(/\x0A/, "\033:", t)
- return t
+ if (p) {
+ delete A[p]
+ return (A[p] = v)
}
+ return v
+}
- function _Zexparr_i0(S, t, i)
- {
+#_______________________________________________________________________
+function _Zexparr(S, s, t, i)
+{
+ ##############################################
+ t = ""
+ if (isarray(S)) {
for (i in S) {
t = t ((isarray(S[i]) ? _Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020" : _Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020"))
}
- return t
- }
-
- function _Zexparr_i1(t)
- {
- gsub(/\x1B/, "\033;", t)
- gsub(/\x11/, "\0331", t)
- gsub(/\x10/, "\0330", t)
- return t
}
-
- function _Zexparr_i2(t)
- {
- gsub(/\x10/, "\0330", t)
+ if (s != "") {
+ gsub(/\x1B/, "\033;", s)
+ gsub(/\x10/, "\0330", s)
+ t = t "\021\021\020" s
+ }
+ gsub(/\x0A/, "\033:", t)
+ return t
+}
+
+#_________________________________________________________________
+function _Zexparr_i0(S, t, i)
+{
+ for (i in S) {
+ t = t ((isarray(S[i]) ? _Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020" : _Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020"))
+ }
+ return t
+}
+
+#_________________________________________________________________
+function _Zexparr_i1(t)
+{
+ gsub(/\x1B/, "\033;", t)
+ gsub(/\x11/, "\0331", t)
+ gsub(/\x10/, "\0330", t)
+ return t
+}
+
+#_________________________________________________________________
+function _Zexparr_i2(t)
+{
+ gsub(/\x10/, "\0330", t)
+ return t
+}
+
+#_________________________________________________________________
+function _Zexparr_i3(t)
+{
+ gsub(/\x1B/, "\033;", t)
+ gsub(/\x11/, "\0331", t)
+ return t
+}
+
+#_______________________________________________________________________
+function _Zimparr(D, t, A, B)
+{
+ ##############################################
+ if (isarray(D)) {
+ split(t, A, /\x10/, B)
+ t = _Zimparr_i0(A, B, _Zimparr_i1(D, A, B, 1))
+ gsub(/\x1B\x30/, "\020", t)
+ gsub(/\x1B\x3B/, "\033", t)
return t
}
+}
- function _Zexparr_i3(t)
- {
- gsub(/\x1B/, "\033;", t)
- gsub(/\x11/, "\0331", t)
- return t
- }
+#_________________________________________________________________
+function _Zimparr_i0(A, B, i)
+{
+ return ((i in A ? A[i] B[i] _Zimparr_i0(A, B, i + 1) : ""))
+}
- function _Zimparr(D, t, A, B)
- {
- if (isarray(D)) {
- split(t, A, /\x10/, B)
- t = _Zimparr_i0(A, B, _Zimparr_i1(D, A, B, 1))
- gsub(/\x1B\x30/, "\020", t)
- gsub(/\x1B\x3B/, "\033", t)
- return t
+#_________________________________________________________________
+function _Zimparr_i1(D, A, B, i, t, a, n)
+{
+ while (i in B) {
+ if ((t = A[i++]) == "\021\021") {
+ return i
}
- }
-
- function _Zimparr_i0(A, B, i)
- {
- return ((i in A ? A[i] B[i] _Zimparr_i0(A, B, i + 1) : ""))
- }
-
- function _Zimparr_i1(D, A, B, i, t, a, n)
- {
- while (i in B) {
- if ((t = A[i++]) == "\021\021") {
- return i
+ gsub(/\x1B\x30/, "\020", t)
+ if ((a = index(t, "\021")) > 0) {
+ if (isarray(D[n = _Zimparr_i2(substr(t, 1, a - 1))])) {
+ delete D[n]
}
- gsub(/\x1B\x30/, "\020", t)
- if ((a = index(t, "\021")) > 0) {
- if (isarray(D[n = _Zimparr_i2(substr(t, 1, a - 1))])) {
- delete D[n]
- }
- D[n] = _Zimparr_i2(substr(t, a + 1))
+ D[n] = _Zimparr_i2(substr(t, a + 1))
+ } else {
+ if (! isarray(D[t = _Zimparr_i2(t)])) {
+ delete D[t]
+ D[t][""]
+ delete D[t][""]
+ }
+ i = _Zimparr_i1(D[t], A, B, i)
+ }
+ }
+}
+
+#_________________________________________________________________
+function _Zimparr_i2(t)
+{
+ gsub(/\x1B\x31/, "\021", t)
+ gsub(/\x1B\x3B/, "\033", t)
+ return t
+}
+
+#_____________________________________________________________________________
+function _Zimport(t, p, A, c, i, n, B)
+{
+ ##############################################
+ if (p) {
+ c = split(t, B, /\x0A/)
+ for (i = 1; i <= c; i++) {
+ if ((t = B[i]) == "") {
+ continue
+ }
+ gsub(/\x1B\x3A/, "\n", t)
+ if (match(t, /^_ERRLOG: /)) {
+ _tLOG[n = _wLCHLD(p, _N())][""]
+ delete _tLOG[n][""]
+ _Zimparr(_tLOG[n], substr(t, 10))
} else {
- if (! isarray(D[t = _Zimparr_i2(t)])) {
- delete D[t]
- D[t][""]
- delete D[t][""]
+ if ((t = _pass(_IMPORT, t, p, A)) != "") {
+ gsub(/\x1B\x3B/, "\033", t)
+ _wLCHLD(p, _N(_tSTR, t))
}
- i = _Zimparr_i1(D[t], A, B, i)
}
}
- }
-
- function _Zimparr_i2(t)
- {
- gsub(/\x1B\x31/, "\021", t)
- gsub(/\x1B\x3B/, "\033", t)
- return t
- }
-
- function _Zimport(t, p, A, c, i, n, B)
- {
- if (p) {
- c = split(t, B, /\x0A/)
- for (i = 1; i <= c; i++) {
- if ((t = B[i]) == "") {
- continue
- }
- gsub(/\x1B\x3A/, "\n", t)
- if (match(t, /^_ERRLOG: /)) {
- _tLOG[n = _wLCHLD(p, _N())][""]
- delete _tLOG[n][""]
- _Zimparr(_tLOG[n], substr(t, 10))
+ return p
+ } else {
+ _expout(t)
+ }
+}
+
+function _acc(A, a, t)
+{
+ if (t) {
+ if (_VLDMAXSTRING < length(t) + length(a)) {
+ if (a) {
+ if (_VLDMAXSTRING < length(t)) {
+ A[--A[_ARRPTR]] = a
+ A[--A[_ARRPTR]] = t
} else {
- if ((t = _pass(_IMPORT, t, p, A)) != "") {
- gsub(/\x1B\x3B/, "\033", t)
- _wLCHLD(p, _N(_tSTR, t))
- }
+ A[--A[_ARRPTR]] = a t
}
+ } else {
+ A[++A[_ARRLEN]] = t
}
- return p
- } else {
- _expout(t)
+ return ""
}
+ return (a t)
}
+ return a
+}
- function _acc(A, a, t)
- {
- if (t) {
- if (_VLDMAXSTRING < length(t) + length(a)) {
- if (a) {
- if (_VLDMAXSTRING < length(t)) {
- A[--A[_ARRPTR]] = a
- A[--A[_ARRPTR]] = t
- } else {
- A[--A[_ARRPTR]] = a t
- }
- } else {
- A[++A[_ARRLEN]] = t
- }
- return ""
- }
- return (a t)
- }
- return a
+function _accmpu(A, a, n)
+{
+ if (n) {
+ return (_mpufn0 = n)
}
-
- function _accmpu(A, a, n)
- {
- if (n) {
- return (_mpufn0 = n)
- }
- if (_mpuacc) {
- if (_VLDMAXSTRING < length(_mpuacc) + length(a)) {
- if (a) {
- if (_VLDMAXSTRING < length(_mpuacc)) {
- A[--A[_ARRLEN]] = a
- A[--A[_ARRLEN]] = _mpuacc
- } else {
- A[--A[_ARRLEN]] = a _mpuacc
- }
- } else {
+ if (_mpuacc) {
+ if (_VLDMAXSTRING < length(_mpuacc) + length(a)) {
+ if (a) {
+ if (_VLDMAXSTRING < length(_mpuacc)) {
+ A[--A[_ARRLEN]] = a
A[--A[_ARRLEN]] = _mpuacc
+ } else {
+ A[--A[_ARRLEN]] = a _mpuacc
}
- _mpuacc = ""
} else {
- _mpuacc = a _mpuacc
+ A[--A[_ARRLEN]] = _mpuacc
}
+ _mpuacc = ""
} else {
- _mpuacc = a
+ _mpuacc = a _mpuacc
}
+ } else {
+ _mpuacc = a
}
+}
- function _add(S, sf, D, df)
- {
- if (sf in S) {
- if (isarray(S[sf])) {
- if (df in D) {
- if (isarray(D[df])) {
- return _extarr(D[df], S[sf])
- }
- delete D[df]
- }
- D[df][""]
- delete D[df][""]
- return _extarr(D[df], S[sf])
- } else {
+#_______________________________________________________________________
+function _add(S, sf, D, df)
+{
+ ################################################
+ if (sf in S) {
+ if (isarray(S[sf])) {
+ if (df in D) {
if (isarray(D[df])) {
- delete D[df]
+ return _extarr(D[df], S[sf])
}
- D[df] = D[df] S[sf]
+ delete D[df]
}
+ D[df][""]
+ delete D[df][""]
+ return _extarr(D[df], S[sf])
+ } else {
+ if (isarray(D[df])) {
+ delete D[df]
+ }
+ D[df] = D[df] S[sf]
}
}
+}
- function _addarr(D, S)
- {
- if (isarray(S)) {
- _addarr_i0(D, S)
- }
- }
-
- function _addarr_i0(D, S, i)
- {
- for (i in S) {
- if (isarray(S[i])) {
- delete D[i]
- D[i][""]
- delete D[i][""]
- _addarr_i0(D[i], S[i])
- } else {
- delete D[i]
- D[i] = S[i]
- }
- }
+#_________________________________________________________________
+function _addarr(D, S)
+{
+ #############################################
+ if (isarray(S)) {
+ _addarr_i0(D, S)
}
+}
- function _addarrmask(D, S, M)
- {
- for (_addarrmaski0 in M) {
- if (_addarrmaski0 in S) {
- if (isarray(S[_addarrmaski0])) {
- if (! isarray(D[_addarrmaski0])) {
- delete D[_addarrmaski0]
- D[_addarrmaski0][""]
- delete D[_addarrmaski0][""]
- }
- if (isarray(M[_addarrmaski0])) {
- _addarrmask(D[_addarrmaski0], S[_addarrmaski0], M[_addarrmaski0])
- } else {
- _extarr_i0(D[_addarrmaski0], S[_addarrmaski0])
- }
+#_____________________________________________________
+function _addarr_i0(D, S, i)
+{
+ for (i in S) {
+ if (isarray(S[i])) {
+ delete D[i]
+ D[i][""]
+ delete D[i][""]
+ _addarr_i0(D[i], S[i])
+ } else {
+ delete D[i]
+ D[i] = S[i]
+ }
+ }
+}
+
+#_______________________________________________________________________
+function _addarrmask(D, S, M)
+{
+ #############################################
+ for (_addarrmaski0 in M) {
+ if (_addarrmaski0 in S) {
+ if (isarray(S[_addarrmaski0])) {
+ if (! isarray(D[_addarrmaski0])) {
+ delete D[_addarrmaski0]
+ D[_addarrmaski0][""]
+ delete D[_addarrmaski0][""]
+ }
+ if (isarray(M[_addarrmaski0])) {
+ _addarrmask(D[_addarrmaski0], S[_addarrmaski0], M[_addarrmaski0])
} else {
- if (isarray(D[_addarrmaski0])) {
- delete D[_addarrmaski0]
- }
- D[_addarrmaski0] = S[_addarrmaski0]
+ _extarr_i0(D[_addarrmaski0], S[_addarrmaski0])
}
} else {
- delete D[_addarrmaski0]
+ if (isarray(D[_addarrmaski0])) {
+ delete D[_addarrmaski0]
+ }
+ D[_addarrmaski0] = S[_addarrmaski0]
}
+ } else {
+ delete D[_addarrmaski0]
}
}
+}
- function _addf(A, f)
- {
- A["B"][""] = A["F"][A["B"][f] = A["B"][""]] = f
- }
+#___________________________________________________________________________________
+####################################################################################
- function _addfile(f, d, a, b)
- {
- if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
- ERRNO = "Filename error"
- return
- }
- a = BINMODE
- BINMODE = "rw"
- b = ORS
- ORS = ""
- ERRNO = ""
- print(d) >> f
- if (ERRNO) {
- return ""
- }
- close(f)
- BINMODE = a
- ORS = b
- if (ERRNO) {
- return ""
- }
- return d
- }
- function _addlib(f)
- {
- _addf(_LIBAPI, f)
- }
+#_______________________________________________________________________
+function _addf(A, f)
+{
+ #####################################################
+ A["B"][""] = A["F"][A["B"][f] = A["B"][""]] = f
+}
- function _addlist(A, v)
- {
- A[++A[0]] = v
+#___________________________________________________________
+function _addfile(f, d, a, b)
+{
+ ##################################
+ if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
+ ERRNO = "Filename error"
+ return
}
-
- function _bearray(A)
- {
- if (isarray(A) || A == 0 && A == "") {
- return 1
- }
+ a = BINMODE
+ BINMODE = "rw"
+ b = ORS
+ ORS = ""
+ ERRNO = ""
+ print(d) >> f
+ if (ERRNO) {
+ return ""
}
-
- function _bframe(A, t, p)
- {
- return _bframe_i0(A, t, p, A[""])
+ close(f)
+ BINMODE = a
+ ORS = b
+ if (ERRNO) {
+ return ""
}
-
- function _bframe_i0(A, t, p, f)
- {
- return ((f ? _bframe_i0(A, t, p, A[f]) (@f(t, p)) : ""))
+ return d
+}
+
+#_____________________________________________________________________________
+function _addlib(f)
+{
+ ###########################################################
+ _addf(_LIBAPI, f)
+}
+
+#___________________________________________________________________________________
+####################################################################################
+
+
+#_______________________________________________________________________
+function _addlist(A, v)
+{
+ ##################################################
+ A[++A[0]] = v
+}
+
+############################################
+#_______________________________________________________________________
+function _bearray(A)
+{
+ ####################################################
+ if (isarray(A) || A == 0 && A == "") {
+ return 1
}
+}
- function _cfguid(p, optr, pfx, sfx, hstrcnt, lstrchr)
- {
- delete _UIDOBL[p]
- if (_isptr(optr)) {
- if (optr == p) {
- delete _UIDOBLV[p]
- delete _UIDOBLV[_UIDOBLV[_UIDOBL[p] = p][""] = p][""]
- } else {
- if (optr in _UIDOBL) {
- _UIDOBL[p] = _UIDOBL[optr]
- }
- }
- }
- _UIDPFX[p] = (_istr(pfx) ? pfx : "")
- _UIDSFX[p] = (_istr(sfx) ? sfx : "")
- if (_isptr(hstrcnt)) {
- if (hstrcnt != p) {
- _UIDCHR[p] = _UIDCHR[_UIDCNT[p] = _UIDCNT[hstrcnt]]
- return p
- }
- hstrcnt = _NOP
- }
- _UIDCNTL[_UIDCNT[p] = p] = _cfguidchr(p, hstrcnt, lstrchr)
- return p
- }
+#_________________________________________________________________
+function _bframe(A, t, p)
+{
+ ###########################################
+ return _bframe_i0(A, t, p, A[""])
+}
- function _cfguidchr(p, h, l, H, L)
- {
- if (_isptr(l)) {
- if (l != p) {
- return (_UIDCHR[p] = _UIDCHR[l])
- }
- _UIDCHR[p] = p
- l = _NOP
- }
- _UIDCHR[p] = p
- _splitstr(H, h, _UIDCHRH[_classys])
- _splitstr(L, l, H)
- delete _UIDCHRH[_UIDCHRH[p][""] = p][""]
- delete _UIDCHRL[_UIDCHRL[p][""] = p][""]
- _cfguidh(p, H, L)
- return _cfguidl(p, L, L)
- }
-
- function _cfguidh(p, H, L, hi, h, li)
- {
- for (hi = 1; hi in H; hi++) {
- h = H[hi]
- for (li = 1; li in L; li++) {
- _UIDCHRH[p][h L[li]]
- }
- }
- }
+#___________________________________________________________
+function _bframe_i0(A, t, p, f)
+{
+ return ((f ? _bframe_i0(A, t, p, A[f]) (@f(t, p)) : ""))
+}
- function _cfguidl(p, H, L, hi, h, hl, li)
- {
- for (hi = 1; hi in H; hi++) {
- h = H[hi]
- for (li = 1; li in L; li++) {
- hl = _UIDCHRL[p][hl] = h L[li]
- }
- }
- return hl
- }
+# add to _dumparr: checking that if element is undefined
- function _check(p)
- {
- _dll_check(p)
- _file_check(p)
- _serv_check(p)
- _reg_check(p)
- }
- function _chrline(t, ts, w, s)
- {
- return ((t = " " _tabtospc(t, ts) ((t ? (t ~ /[ \t]$/ ? "" : " ") : ""))) _getchrln((s ? s : "_"), ((w ? w : _CON_WIDTH - 1)) - length(t)) _CHR["EOL"])
- }
- function _cmd(c, i, A)
- {
- _fio_cmda = RS
- RS = ".{1,}"
- _fio_cmdb = BINMODE
- BINMODE = "rw"
- ERRNO = RT = _NUL
- c | getline RS
- BINMODE = _fio_cmdb
- RS = _fio_cmda
- if (ERRNO || 0 > (_exitcode = close(c))) {
- return (RT = _NOP)
- }
- return RT
- }
- function _cmparr(A0, A1, R, a, i)
- {
- a = 0
- delete R
- for (i in A0) {
- if (! (i in A1)) {
- a++
- R[i] = 0
- } else {
- if (A0[i] != A1[i]) {
- a++
- R[i] = 2
- }
- }
- }
- for (i in A1) {
- if (! (i in A0)) {
- a++
- R[i] = 1
- }
- }
- return a
- }
- function _con(t, ts, a, b, c, d, i, r, A, B)
- {
- d = RLENGTH
- if ((c = split(r = t, A, /\x0D?\x0A/, B)) > 0) {
- a = BINMODE
- b = ORS
- BINMODE = "rw"
- ORS = ""
- if (c > 1) {
- if ((i = length(t = _tabtospc(A[1], ts, _conlastrln))) < _constatstrln) {
- t = t _getchrln(" ", _constatstrln - i)
- }
- print(t B[1]) > _SYS_STDCON
- for (i = 2; i < c; i++) {
- print(_tabtospc(A[i], ts) B[i]) > _SYS_STDCON
- }
- print(_conlastr = _tabtospc(A[c], ts)) > _SYS_STDCON
- fflush(_SYS_STDCON)
- } else {
- print(t = _tabtospc(t, ts, _conlastrln)) > _SYS_STDCON
- fflush(_SYS_STDCON)
- _conlastr = _conlastr t
- }
- if ((i = length(_conlastr)) >= _CON_WIDTH) {
- _conlastr = substr(_conlastr, 1 + int(i / _CON_WIDTH) * _CON_WIDTH)
- }
- _conlastrln = length(_conlastr)
- if (_constatstr) {
- print((t = _constatgtstr(_constatstr, _CON_WIDTH - 1 - _conlastrln)) _CHR["CR"] _conlastr) > _SYS_STDCON
- fflush(_SYS_STDCON)
- _constatstrln = length(t)
- }
- BINMODE = a
- ORS = b
- RLENGTH = d
- return r
- }
- RLENGTH = d
- }
- function _conin(t, a, b)
- {
- _constatpush()
- _constat()
- a = BINMODE
- b = RS
- BINMODE = "rw"
- RS = "\n"
- _con(t)
- getline t < "CON"
- close("CON")
- _conlastrln = 0
- _conlastr = ""
- gsub(/[\x0D\x0A]+/, "", t)
- BINMODE = a
- RS = b
- _constatpop()
- return t
- }
- function _conl(t, ts)
- {
- return _con(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])), ts)
- }
- function _conline(t, ts)
- {
- return _con(_chrline(t, ts))
- }
- function _conlq(t, ts)
- {
- return _conl("`" t "'", ts)
- }
- function _constat(t, ts, ln, a)
- {
- if (_constatstrln > (ln = length(t = _constatgtstr(_constatstr = _tabtospc(t, ts), _CON_WIDTH - 1 - _conlastrln)))) {
- t = t _getchrln(" ", _constatstrln - ln)
- }
- _constatstrln = ln
- ln = ORS
- a = BINMODE
- BINMODE = "rw"
- ORS = ""
- print(t _CHR["CR"] _conlastr) > _SYS_STDCON
- fflush(_SYS_STDCON)
- ORS = ln
- BINMODE = a
- return _constatstr
- }
- function _constatgtstr(t, ln, a, b)
- {
- if (ln < 1) {
- return ""
- }
- if ((a = length(t)) <= ln) {
- return t
- }
- if (ln < 11) {
- return substr(t, a - ln + 1)
- }
- if (ln < 19) {
- return ("..." substr(t, a - ln + 4))
- }
- return (substr(t, 1, b = int((ln - 3) / 2)) "..." substr(t, a - ln + b + 4))
- }
- function _constatpop()
- {
- if (_CONSTATPUSH[0] > 0) {
- return _constat(_CONSTATPUSH[_CONSTATPUSH[0]--])
- }
- return _constat("")
- }
- function _constatpush(t, ts)
- {
- _CONSTATPUSH[++_CONSTATPUSH[0]] = _constatstr
- if (t) {
- _constat(t, ts)
- }
- return _constatstr
- }
- function _creport(p, t, f, z)
- {
- _[p]["REPORT"] = _[p]["REPORT"] _ln(t ((f == "" ? "" : ": " f)))
- }
- function _defdir(pp, n, f, v, p)
- {
- _[p = _wLCHLD(pp, _n("TYPE", "defdir"))]["NAME"] = n
- _[p]["DIR"] = f
- return p
- }
- function _defdll(pp, n, rn, p)
- {
- _[p = _wLCHLD(pp, _n("TYPE", "defdll"))]["NAME"] = n
- _[p]["REGPATH"] = _[pp]["REGPATH"] rn
- _[p]["ERRHOST"] = pp
- return p
- }
- function _defescarr(D, r, S, i, c, t)
- {
- if (isarray(S)) {
- for (i = 0; i < 256; i++) {
- if ((c = _CHR[i]) ~ r) {
- D[c] = "\\" S[c]
- t = t c
- } else {
- if (D[c] == "") {
- D[c] = c
- }
- }
- }
+
+#_______________________________________________________________________
+function _cfguid(p, optr, pfx, sfx, hstrcnt, lstrchr)
+{
+ #################### 0 #
+ delete _UIDOBL[p]
+ if (_isptr(optr)) {
+ if (optr == p) {
+ delete _UIDOBLV[p]
+ delete _UIDOBLV[_UIDOBLV[_UIDOBL[p] = p][""] = p][""]
} else {
- for (i = 0; i < 256; i++) {
- if ((c = _CHR[i]) ~ r) {
- D[c] = S c
- if (S != "") {
- t = t c
- }
- } else {
- if (D[c] == "") {
- D[c] = c
- }
- }
+ if (optr in _UIDOBL) {
+ _UIDOBL[p] = _UIDOBL[optr]
}
}
- return t
}
-
- function _defile(pp, n, f, v, p)
- {
- _[p = _wLCHLD(pp, _n("TYPE", "defile"))]["NAME"] = n
- _[p]["FILE"] = f
- if (! (v == 0 && v == "")) {
- _[p]["RQVERSION"] = v
+ _UIDPFX[p] = (_istr(pfx) ? pfx : "")
+ _UIDSFX[p] = (_istr(sfx) ? sfx : "")
+ if (_isptr(hstrcnt)) {
+ if (hstrcnt != p) {
+ _UIDCHR[p] = _UIDCHR[_UIDCNT[p] = _UIDCNT[hstrcnt]]
+ return p
}
- return p
+ hstrcnt = _NOP
}
+ _UIDCNTL[_UIDCNT[p] = p] = _cfguidchr(p, hstrcnt, lstrchr)
+ return p
+}
- function _defn(f, c, v)
- {
- FUNCTAB[c f] = v
- }
-
- function _defreg(pp, n, f, v, p)
- {
- _[p = _wLCHLD(pp, _n("TYPE", "defreg"))]["NAME"] = n
- _[p]["REGPATH"] = f
- if (! (v == 0 && v == "")) {
- _[p]["VALUE"] = v
+#_____________________________________________________
+function _cfguidchr(p, h, l, H, L)
+{
+ if (_isptr(l)) {
+ if (l != p) {
+ return (_UIDCHR[p] = _UIDCHR[l])
}
+ _UIDCHR[p] = p
+ l = _NOP
+ }
+ _UIDCHR[p] = p
+ _splitstr(H, h, _UIDCHRH[_classys])
+ _splitstr(L, l, H)
+ delete _UIDCHRH[_UIDCHRH[p][""] = p][""]
+ delete _UIDCHRL[_UIDCHRL[p][""] = p][""]
+ _cfguidh(p, H, L)
+ return _cfguidl(p, L, L)
+}
+
+#_______________________________________________
+function _cfguidh(p, H, L, hi, h, li)
+{
+ for (hi = 1; hi in H; hi++) {
+ h = H[hi]
+ for (li = 1; li in L; li++) {
+ _UIDCHRH[p][h L[li]]
+ }
+ }
+}
+
+function _cfguidl(p, H, L, hi, h, hl, li)
+{
+ for (hi = 1; hi in H; hi++) {
+ h = H[hi]
+ for (li = 1; li in L; li++) {
+ hl = _UIDCHRL[p][hl] = h L[li]
+ }
+ }
+ return hl
+}
+
+#____________________________________________________________________________________________________
+function _check(p)
+{
+ ####################################################################################
+ _dll_check(p)
+ _file_check(p)
+ _serv_check(p)
+ _reg_check(p)
+}
+
+#_______________________________________________________________________
+function _chrline(t, ts, w, s)
+{
+ #############################################
+ return ((t = " " _tabtospc(t, ts) ((t ? (t ~ /[ \t]$/ ? "" : " ") : ""))) _getchrln((s ? s : "_"), ((w ? w : _CON_WIDTH - 1)) - length(t)) _CHR["EOL"])
+}
+
+#_____________________________________________________________________________
+function _cmd(c, i, A)
+{
+ #######################################################
+ _fio_cmda = RS
+ RS = ".{1,}"
+ _fio_cmdb = BINMODE
+ BINMODE = "rw"
+ ERRNO = RT = _NUL
+ c | getline RS
+ BINMODE = _fio_cmdb
+ RS = _fio_cmda
+ if (ERRNO || 0 > (_exitcode = close(c))) {
+ return (RT = _NOP)
}
-
- function _defsolution(pp, n, rn, p)
- {
- _[p = _wLCHLD(pp, _n("TYPE", "solution"))]["NAME"] = n
- _[p]["REGPATH"] = rn
- _[p]["ERRHOST"] = pp
- return p
- }
-
- function _defsrv(pp, n, f, v, p)
- {
- _[p = _wLCHLD(pp, _n("TYPE", "defsrv"))]["NAME"] = n
- _[p]["SERVNAME"] = f
- return p
- }
-
- function _del(f, c, a, A)
- {
- if (match(f, /\\[ \t]*$/)) {
- if ((c = toupper(_filerd(f))) && length(f) == FLENGTH) {
- _cmd("rd " c " /S /Q 2>NUL")
- _deletepfx(_WFILEROOTDIR, c)
- _deletepfx(_FILEIO_RDTMP, c)
- _deletepfx(_FILEIO_RDNETMP, c)
- } else {
- _conl("HUJ TEBE!")
- return ""
- }
+ return RT
+}
+
+#_______________________________________________________________________
+function _cmparr(A0, A1, R, a, i)
+{
+ ##########################################
+ a = 0
+ delete R
+ for (i in A0) {
+ if (! (i in A1)) {
+ a++
+ R[i] = 0
} else {
- a = _dir(A, f)
- _cmd("del " f " /Q 2>NUL")
- for (c in A) {
- if (c ~ /\\$/) {
- _cmd("rd " c " /S /Q 2>NUL")
- _deletepfx(_WFILEROOTDIR, c)
- _deletepfx(_FILEIO_RDTMP, c)
- }
- _deletepfx(_FILEIO_RDNETMP, c)
+ if (A0[i] != A1[i]) {
+ a++
+ R[i] = 2
}
}
- return a
}
-
- function _delay(t, a)
- {
- for (a = 1; a <= t; a++) {
- _delayms()
- }
- }
-
- function _delayms(a)
- {
- for (a = 1; a <= _delay_perfmsdelay; a++) {
+ for (i in A1) {
+ if (! (i in A0)) {
+ a++
+ R[i] = 1
}
}
+ return a
+}
- function _deletepfx(A, f, B, le, i)
- {
- le = length(f)
- for (i in A) {
- if (substr(toupper(i), 1, le) == f) {
- B[i] = A[i]
- delete A[i]
+#_____________________________________________________________________________
+function _con(t, ts, a, b, c, d, i, r, A, B)
+{
+ ##########################################
+ d = RLENGTH
+ if ((c = split(r = t, A, /\x0D?\x0A/, B)) > 0) {
+ a = BINMODE
+ b = ORS
+ BINMODE = "rw"
+ ORS = ""
+ if (c > 1) {
+ if ((i = length(t = _tabtospc(A[1], ts, _conlastrln))) < _constatstrln) {
+ t = t _getchrln(" ", _constatstrln - i)
}
+ print(t B[1]) > _SYS_STDCON
+ for (i = 2; i < c; i++) {
+ print(_tabtospc(A[i], ts) B[i]) > _SYS_STDCON
+ }
+ print(_conlastr = _tabtospc(A[c], ts)) > _SYS_STDCON
+ fflush(_SYS_STDCON)
+ } else {
+ print(t = _tabtospc(t, ts, _conlastrln)) > _SYS_STDCON
+ fflush(_SYS_STDCON)
+ _conlastr = _conlastr t
+ }
+ if ((i = length(_conlastr)) >= _CON_WIDTH) {
+ _conlastr = substr(_conlastr, 1 + int(i / _CON_WIDTH) * _CON_WIDTH)
}
+ _conlastrln = length(_conlastr)
+ if (_constatstr) {
+ print((t = _constatgtstr(_constatstr, _CON_WIDTH - 1 - _conlastrln)) _CHR["CR"] _conlastr) > _SYS_STDCON
+ fflush(_SYS_STDCON)
+ _constatstrln = length(t)
+ }
+ BINMODE = a
+ ORS = b
+ RLENGTH = d
+ return r
}
-
- function _delf(A, f)
- {
- A["B"][A["F"][A["B"][f]] = A["F"][f]] = A["B"][f]
- delete A["F"][f]
- delete A["B"][f]
+ RLENGTH = d
+}
+
+#_______________________________________________________________________
+function _conin(t, a, b)
+{
+ #################################################
+ _constatpush()
+ _constat()
+ a = BINMODE
+ b = RS
+ BINMODE = "rw"
+ RS = "\n"
+ _con(t)
+ getline t < "CON"
+ close("CON")
+ _conlastrln = 0
+ _conlastr = ""
+ gsub(/[\x0D\x0A]+/, "", t)
+ BINMODE = a
+ RS = b
+ _constatpop()
+ return t
+}
+
+#_______________________________________________________________________
+function _conl(t, ts)
+{
+ ####################################################
+ return _con(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])), ts)
+}
+
+#_______________________________________________________________________
+function _conline(t, ts)
+{
+ #################################################
+ return _con(_chrline(t, ts))
+}
+
+#___________________________________________________________________________________
+####################################################################################
+
+
+
+function _conlq(t, ts)
+{
+ return _conl("`" t "'", ts)
+}
+
+#_______________________________________________________________________
+function _constat(t, ts, ln, a)
+{
+ ###########################################
+ if (_constatstrln > (ln = length(t = _constatgtstr(_constatstr = _tabtospc(t, ts), _CON_WIDTH - 1 - _conlastrln)))) {
+ t = t _getchrln(" ", _constatstrln - ln)
+ }
+ _constatstrln = ln
+ ln = ORS
+ a = BINMODE
+ BINMODE = "rw"
+ ORS = ""
+ print(t _CHR["CR"] _conlastr) > _SYS_STDCON
+ fflush(_SYS_STDCON)
+ ORS = ln
+ BINMODE = a
+ return _constatstr
+}
+
+#_________________________________________________________________
+function _constatgtstr(t, ln, a, b)
+{
+ if (ln < 1) {
+ return ""
}
-
- function _deluid(p)
- {
- if (p in _CLASSPTR) {
- _deluida0 = _CLASSPTR[p]
- if (_deluida0 in _UIDOBL) {
- _UIDOBLV[_UIDOBL[_deluida0]][p]
- }
- }
- delete _CLASSPTR[p]
- return _deluida0
+ if ((a = length(t)) <= ln) {
+ return t
}
-
- function _dir(A, rd, i, r, f, ds, pf, B, C)
- {
- delete A
- gsub(/(^[ \t]*)|([ \t]*$)/, "", rd)
- if (rd == "") {
- return ""
+ if (ln < 11) {
+ return substr(t, a - ln + 1)
+ }
+ if (ln < 19) {
+ return ("..." substr(t, a - ln + 4))
+ }
+ return (substr(t, 1, b = int((ln - 3) / 2)) "..." substr(t, a - ln + b + 4))
+}
+
+#_______________________________________________________________________
+function _constatpop()
+{
+ ##################################################
+ if (_CONSTATPUSH[0] > 0) {
+ return _constat(_CONSTATPUSH[_CONSTATPUSH[0]--])
+ }
+ return _constat("")
+}
+
+#_______________________________________________________________________
+function _constatpush(t, ts)
+{
+ #############################################
+ _CONSTATPUSH[++_CONSTATPUSH[0]] = _constatstr
+ if (t) {
+ _constat(t, ts)
+ }
+ return _constatstr
+}
+
+#___________________________________________________________________________________
+function _creport(p, t, f, z)
+{
+ _[p]["REPORT"] = _[p]["REPORT"] _ln(t ((f == "" ? "" : ": " f)))
+}
+
+#_________________________________________________________________________________________
+function _defdir(pp, n, f, v, p)
+{
+ #############################################################
+ _[p = _wLCHLD(pp, _n("TYPE", "defdir"))]["NAME"] = n
+ _[p]["DIR"] = f
+ return p
+}
+
+#_________________________________________________________________________________________
+function _defdll(pp, n, rn, p)
+{
+ ##############################################################
+ _[p = _wLCHLD(pp, _n("TYPE", "defdll"))]["NAME"] = n
+ _[p]["REGPATH"] = _[pp]["REGPATH"] rn
+ _[p]["ERRHOST"] = pp
+ return p
+}
+
+#___________________________________________________________
+function _defescarr(D, r, S, i, c, t)
+{
+ if (isarray(S)) {
+ for (i = 0; i < 256; i++) {
+ if ((c = _CHR[i]) ~ r) {
+ D[c] = "\\" S[c]
+ t = t c
+ } else {
+ if (D[c] == "") {
+ D[c] = c
+ }
+ }
}
- i = split(_cmd("dir \"" rd "\" 2>NUL"), B, /\x0D?\x0A/) - 3
- pf = (match(B[4], /Directory of ([^\x00-\x1F]+)/, C) ? C[1] ((C[1] ~ /\\$/ ? "" : "\\")) : "")
- for (r = 0; i > 5; i--) {
- if (match(B[i], /^([^ \t]*)[ \t]+([^ \t]*)[ \t]+((<DIR>)|([0-9\,]+))[ \t]+([^\x00-\x1F]+)$/, C)) {
- if (C[6] !~ /^\.\.?$/) {
- if (C[4]) {
- ds = "D "
- } else {
- ds = C[5] " "
- gsub(/\,/, "", ds)
- }
- if ((f = _filepath(pf C[6] ((C[4] ? "\\" : "")))) != "") {
- A[f] = ds C[1] " " C[2]
- r++
- }
+ } else {
+ for (i = 0; i < 256; i++) {
+ if ((c = _CHR[i]) ~ r) {
+ D[c] = S c
+ if (S != "") {
+ t = t c
+ }
+ } else {
+ if (D[c] == "") {
+ D[c] = c
}
}
}
- return r
}
-
- function _dirtree(A, f, B)
- {
- gsub(/(^[ \t]*)|([ \t]*$)/, "", f)
- delete A
- A[""]
- delete A[""]
- _dirtree_i0(B, 8, split(_cmd("dir \"" f "\" /-C /S 2>NUL"), B, /\x0D?\x0A/), A, f = _filerd(f))
- return f
+ return t
+}
+
+#_________________________________________________________________________________________
+function _defile(pp, n, f, v, p)
+{
+ #############################################################
+ _[p = _wLCHLD(pp, _n("TYPE", "defile"))]["NAME"] = n
+ _[p]["FILE"] = f
+ if (! (v == 0 && v == "")) {
+ _[p]["RQVERSION"] = v
+ }
+ return p
+}
+
+#_______________________________________________________________________
+function _defn(f, c, v)
+{
+ ###################################################
+ FUNCTAB[c f] = v
+}
+
+#_________________________________________________________________________________________
+function _defreg(pp, n, f, v, p)
+{
+ #############################################################
+ _[p = _wLCHLD(pp, _n("TYPE", "defreg"))]["NAME"] = n
+ _[p]["REGPATH"] = f
+ if (! (v == 0 && v == "")) {
+ _[p]["VALUE"] = v
+ }
+}
+
+#_______________________________________________________________________________________________
+function _defsolution(pp, n, rn, p)
+{
+ ###############################################################
+ _[p = _wLCHLD(pp, _n("TYPE", "solution"))]["NAME"] = n
+ _[p]["REGPATH"] = rn
+ _[p]["ERRHOST"] = pp
+ return p
+}
+
+#_________________________________________________________________________________________
+function _defsrv(pp, n, f, v, p)
+{
+ #############################################################
+ _[p = _wLCHLD(pp, _n("TYPE", "defsrv"))]["NAME"] = n
+ _[p]["SERVNAME"] = f
+ return p
+}
+
+#_______________________________________________________________________
+function _del(f, c, a, A)
+{
+ #################################################
+ if (match(f, /\\[ \t]*$/)) {
+ if ((c = toupper(_filerd(f))) && length(f) == FLENGTH) {
+ _cmd("rd " c " /S /Q 2>NUL")
+ _deletepfx(_WFILEROOTDIR, c)
+ _deletepfx(_FILEIO_RDTMP, c)
+ _deletepfx(_FILEIO_RDNETMP, c)
+ } else {
+ _conl("HUJ TEBE!")
+ return ""
+ }
+ } else {
+ a = _dir(A, f)
+ _cmd("del " f " /Q 2>NUL")
+ for (c in A) {
+ if (c ~ /\\$/) {
+ _cmd("rd " c " /S /Q 2>NUL")
+ _deletepfx(_WFILEROOTDIR, c)
+ _deletepfx(_FILEIO_RDTMP, c)
+ }
+ _deletepfx(_FILEIO_RDNETMP, c)
+ }
+ }
+ return a
+}
+
+#_______________________________________________________________________
+function _delay(t, a)
+{
+ ###################################################
+ for (a = 1; a <= t; a++) {
+ _delayms()
+ }
+}
+
+#_________________________________________________________________
+function _delayms(a)
+{
+ #############################################
+ for (a = 1; a <= _delay_perfmsdelay; a++) {
+ }
+}
+
+#_______________________________________________________________________
+function _deletepfx(A, f, B, le, i)
+{
+ ########################################
+ le = length(f)
+ for (i in A) {
+ if (substr(toupper(i), 1, le) == f) {
+ B[i] = A[i]
+ delete A[i]
+ }
+ }
+}
+
+#_________________________________________________________________
+function _delf(A, f)
+{
+ ###############################################
+ A["B"][A["F"][A["B"][f]] = A["F"][f]] = A["B"][f]
+ delete A["F"][f]
+ delete A["B"][f]
+}
+
+#_______________________________________________________________________
+function _deluid(p)
+{
+ ################################################# 1 #
+ if (p in _CLASSPTR) {
+ _deluida0 = _CLASSPTR[p]
+ if (_deluida0 in _UIDOBL) {
+ _UIDOBLV[_UIDOBL[_deluida0]][p]
+ }
+ }
+ delete _CLASSPTR[p]
+ return _deluida0
+}
+
+#_______________________________________________________________________
+function _dir(A, rd, i, r, f, ds, pf, B, C)
+{
+ ####################################
+ delete A
+ gsub(/(^[ \t]*)|([ \t]*$)/, "", rd)
+ if (rd == "") {
+ return ""
}
-
- function _dirtree_i0(B, i, c, A, f, lf, a, C)
- {
- delete A[f]
- A[f][0]
- delete A[f][0]
- lf = length(f)
- for (; i <= c; ) {
- if (match(B[i], /^[ \t]*Directory of (.+)/, C)) {
- if (substr(a = _filerd(C[1] "\\"), 1, lf) == f) {
- i = _dirtree_i0(B, i + 4, c, A[f], a)
+ i = split(_cmd("dir \"" rd "\" 2>NUL"), B, /\x0D?\x0A/) - 3
+ pf = (match(B[4], /Directory of ([^\x00-\x1F]+)/, C) ? C[1] ((C[1] ~ /\\$/ ? "" : "\\")) : "")
+ for (r = 0; i > 5; i--) {
+ if (match(B[i], /^([^ \t]*)[ \t]+([^ \t]*)[ \t]+((<DIR>)|([0-9\,]+))[ \t]+([^\x00-\x1F]+)$/, C)) {
+ if (C[6] !~ /^\.\.?$/) {
+ if (C[4]) {
+ ds = "D "
} else {
- return i
+ ds = C[5] " "
+ gsub(/\,/, "", ds)
}
- } else {
- if (match(B[i++], /^([^ \t\-]+)\-([^ \t\-]+)\-([^ \t]+)[ \t]+([^ \t]+)[ \t]+([0-9]+)[ \t]+(.+)$/, C)) {
- A[f][f C[6]] = C[5] " " C[1] "/" _CHR["MONTH"][C[2]] "/" C[3] " " C[4]
+ if ((f = _filepath(pf C[6] ((C[4] ? "\\" : "")))) != "") {
+ A[f] = ds C[1] " " C[2]
+ r++
}
}
}
- return i
}
-
- function _dll_check(pp)
- {
- _dllchktv = ""
- _missfl = 1
- _tframe("_dll_check_i0", pp, _REG, pp)
- if (1 || "AGENT" in _[pp]) {
- if (_dllchktv != _[pp][".Product Version"]) {
- _dllerr(_[pp]["AGENT"], "agent version (" _[pp][".Product Version"] ") do not match all lib versions: " _dllchktv "'")
+ return r
+}
+
+#_________________________________________________________________
+function _dirtree(A, f, B)
+{
+ #########################################
+ gsub(/(^[ \t]*)|([ \t]*$)/, "", f)
+ delete A
+ A[""]
+ delete A[""]
+ _dirtree_i0(B, 8, split(_cmd("dir \"" f "\" /-C /S 2>NUL"), B, /\x0D?\x0A/), A, f = _filerd(f))
+ return f
+}
+
+#___________________________________________________________
+function _dirtree_i0(B, i, c, A, f, lf, a, C)
+{
+ delete A[f]
+ A[f][0]
+ delete A[f][0]
+ lf = length(f)
+ for (; i <= c; ) {
+ if (match(B[i], /^[ \t]*Directory of (.+)/, C)) {
+ if (substr(a = _filerd(C[1] "\\"), 1, lf) == f) {
+ i = _dirtree_i0(B, i + 4, c, A[f], a)
+ } else {
+ return i
}
} else {
- if (! _missfl) {
- _creport(pp, "agent not detected in registry")
- } else {
- _dllerr(pp, "agent not detected in registry but some registry entries exist:")
- _tframe("_dll_check_i1", pp, pp)
+ if (match(B[i++], /^([^ \t\-]+)\-([^ \t\-]+)\-([^ \t]+)[ \t]+([^ \t]+)[ \t]+([0-9]+)[ \t]+(.+)$/, C)) {
+ A[f][f C[6]] = C[5] " " C[1] "/" _CHR["MONTH"][C[2]] "/" C[3] " " C[4]
}
}
}
+ return i
+}
- function _dll_check_i0(p, R, pp, p2, i, i2, r, f, v, rs, d, tv, tf)
- {
- if (_[p]["TYPE"] == "defdll") {
- r = toupper(_[p]["REGPATH"])
- rs = 0
- tf = 0
- tv = ""
- for (i in R) {
- if (toupper(substr(i, 1, length(r))) == r) {
- if ((_chka0 = substr(i, 1 + length(r), 1)) == "" || _chka0 == "\\") {
+#_______________________________________________________________________
+function _dll_check(pp)
+{
+ _dllchktv = ""
+ _missfl = 1
+ _tframe("_dll_check_i0", pp, _REG, pp)
+ #also check that all dll have same version; also check that all dlls have success and then report that DS plug-in version n - installed
+ if (1 || "AGENT" in _[pp]) {
+ if (_dllchktv != _[pp][".Product Version"]) {
+ _dllerr(_[pp]["AGENT"], "agent version (" _[pp][".Product Version"] ") do not match all lib versions: " _dllchktv "'")
+ }
+ } else {
+ if (! _missfl) {
+ _creport(pp, "agent not detected in registry")
+ } else {
+ _dllerr(pp, "agent not detected in registry but some registry entries exist:")
+ _tframe("_dll_check_i1", pp, pp)
+ }
+ }
+}
+
+#_______________________________________________
+function _dll_check_i0(p, R, pp, p2, i, i2, r, f, v, rs, d, tv, tf)
+{
+ if (_[p]["TYPE"] == "defdll") {
+ r = toupper(_[p]["REGPATH"])
+ rs = 0
+ tf = 0
+ tv = ""
+ for (i in R) {
+ if (toupper(substr(i, 1, length(r))) == r) {
+ if ((_chka0 = substr(i, 1 + length(r), 1)) == "" || _chka0 == "\\") {
+ rs = 1
+ _missfl = 1
+ _[p]["." substr(gensub(/\....$/, "", 1, i), i2 = 2 + length(r), length(i) - i2 + 1)] = R[i]
+ if (chka0 != "") {
rs = 1
- _missfl = 1
- _[p]["." substr(gensub(/\....$/, "", 1, i), i2 = 2 + length(r), length(i) - i2 + 1)] = R[i]
- if (chka0 != "") {
- rs = 1
- }
}
}
}
- if (rs) {
- if ((i = ".Install Path") in _[p] && (i = ".Product Version") in _[p]) {
- _[p]["STATUS"] = "PRESENT"
- f = _[p][".Install Path"]
- v = _[p][".Product Version"]
- if (! (".Module" in _[p])) {
- _[pp][".Product Version"] = v
- _VAR["HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR"] = f
- _[pp]["AGENT"] = p
- _creport("OK: DLL DETECTED(" v "): " substr(_[p]["NAME"], 1, 112))
+ }
+ #{ rs=_missfl=1; _[p]["." gensub(/^([^\\]+\\)+(.*)\..../,"\\2","G",i)]=R[i] } }
+ if (rs) {
+ if ((i = ".Install Path") in _[p] && (i = ".Product Version") in _[p]) {
+ _[p]["STATUS"] = "PRESENT"
+ f = _[p][".Install Path"]
+ v = _[p][".Product Version"]
+ if (! (".Module" in _[p])) {
+ _[pp][".Product Version"] = v
+ _VAR["HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR"] = f
+ _[pp]["AGENT"] = p
+ _creport("OK: DLL DETECTED(" v "): " substr(_[p]["NAME"], 1, 112))
+ } else {
+ if (_dllchktv == "") {
+ _dllchktv = v
} else {
- if (_dllchktv == "") {
- _dllchktv = v
- } else {
- if (v != _dllchktv) {
- return _dllerr(p, "different versions detected: " _dllchktv "!=" v "'")
- }
- }
- ERRNO = ""
- if (_th1(_[p]["DATA"] = _rdfile(f), ERRNO)) {
- delete _[p]["DATA"]
- return _dllerr(p, "read lib: " ERRNO, f)
- }
- if (v != (_[p]["VERSION"] = _getfilever(f))) {
- return _dllerr(p, "library file version mismatch: ==`" _[p]["VERSION"] "'; !=`" v "'", f)
+ if (v != _dllchktv) {
+ return _dllerr(p, "different versions detected: " _dllchktv "!=" v "'")
}
- _creport(p, "OK: LIBRARY DETECTED(" v "): " substr(f, 1, 100))
}
- } else {
- tf = 1
- _dllerr(p, "registry corrupt: `" i "' not present")
+ ERRNO = ""
+ if (_th1(_[p]["DATA"] = _rdfile(f), ERRNO)) {
+ delete _[p]["DATA"]
+ return _dllerr(p, "read lib: " ERRNO, f)
+ }
+ if (v != (_[p]["VERSION"] = _getfilever(f))) {
+ return _dllerr(p, "library file version mismatch: ==`" _[p]["VERSION"] "'; !=`" v "'", f)
+ }
+ _creport(p, "OK: LIBRARY DETECTED(" v "): " substr(f, 1, 100))
}
} else {
- _[p]["STATUS"] = "MISSED"
+ tf = 1
+ _dllerr(p, "registry corrupt: `" i "' not present")
}
+ } else {
+ _[p]["STATUS"] = "MISSED"
}
}
+}
- function _dll_check_i1(p, pp, p1, p2, p3, i)
- {
- if (_[p]["TYPE"] == "defdll") {
- for (i in _[p]) {
- if (i ~ /^\./) {
- _dllerr(pp, " " _[p]["REGPATH"] "\\" substr(i, 2))
- }
+#_______________________________________________
+function _dll_check_i1(p, pp, p1, p2, p3, i)
+{
+ if (_[p]["TYPE"] == "defdll") {
+ for (i in _[p]) {
+ if (i ~ /^\./) {
+ _dllerr(pp, " " _[p]["REGPATH"] "\\" substr(i, 2))
}
}
}
+}
- function _dllerr(p, t, f)
- {
- if (t !~ /\x00/) {
- t = "ERROR: \000" t
- }
- _errfl = 1
- _[p]["ERROR"] = _[p]["ERROR"] _ln(t ((f == "" ? "" : ": " f)))
+#___________________________________________________________________________________
+function _dllerr(p, t, f)
+{
+ if (t !~ /\x00/) {
+ t = "ERROR: \000" t
}
+ _errfl = 1
+ _[p]["ERROR"] = _[p]["ERROR"] _ln(t ((f == "" ? "" : ": " f)))
+}
- function _drawuid(p, cn, ch, o)
- {
- _conl("uid: " p)
- _conl("\toblptr: " ((p in _UIDOBL ? _UIDOBL[p] "'" : "-")))
- if (p in _UIDOBL) {
- if (! _isptr(o = _UIDOBL[p])) {
- _conl(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> oblptr not pointer")
- }
- if (! isarray(_UIDOBLV[o])) {
- _conl(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> no OBLV array at ptr")
- }
+function _drawuid(p, cn, ch, o)
+{
+ _conl("uid: " p)
+ _conl("\toblptr: " ((p in _UIDOBL ? _UIDOBL[p] "'" : "-")))
+ if (p in _UIDOBL) {
+ if (! _isptr(o = _UIDOBL[p])) {
+ _conl(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> oblptr not pointer")
}
- _conl("\tprefix: " ((p in _UIDPFX ? _UIDPFX[p] "'" : "-")))
- _conl("\tsuffix: " ((p in _UIDSFX ? _UIDSFX[p] "'" : "-")))
- _conl("\tcounters: " (cn = (p in _UIDCNT ? _UIDCNT[p] "'" : "-")))
- if (cn != "-") {
- _conl("\t\tcntrL: " _UIDCNTL[_UIDCNT[p]] "'")
- _conl("\t\tcntrH: " _UIDCNTH[_UIDCNT[p]] "'")
- }
- _conl("\tcharset: " (ch = (p in _UIDCHR ? _UIDCHR[p] "'" : "-")))
- if (ch != "-") {
- _conl("chrH: ")
- _conl(_dumparr(_UIDCHRH[_UIDCHR[p]]))
- _conl()
- _conl("chrL: ")
- _conl(_dumparr(_UIDCHRL[_UIDCHR[p]]))
- _conl()
- }
- }
-
- function _dumparr(A, t, lv, a)
- {
- b = PROCINFO["sorted_in"]
- PROCINFO["sorted_in"] = "_lengthsort"
- if (isarray(A)) {
- delete _DUMPARR
- _dumparrc = _dumparrd = ""
- _dumparr_i1(A, lv = ((lv == "" ? 16 : (lv == 0 || lv + 0 != 0 ? lv : (lv == "-*" ? -3 : (lv ~ /^\+?\*$/ ? 3 : 16))))) + 0, (lv < 0 ? -1 : 1), 0, _tabtospc(t))
- PROCINFO["sorted_in"] = a
- return _retarrd(_DUMPARR, _dumparrd, _dumparrd = "")
- }
- }
-
- function _dumparr_i1(A, lv, ls, ln, t, t2, i, a, f)
- {
- t2 = _getchrln(" ", length(t))
- if (ln == lv) {
- if (ls > 0) {
- for (i in A) {
- ++a
- }
- } else {
- for (i in A) {
- (isarray(A[i]) ? ++a : "")
- }
- }
- if (length(_dumparrd = _dumparrd t ((a > 0 ? " ... (x" a ")" : "")) _CHR["EOL"]) > 262144) {
- _DUMPARR[++_dumparrc] = _dumparrd
- _dumparrd = ""
- }
- return
+ if (! isarray(_UIDOBLV[o])) {
+ _conl(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> no OBLV array at ptr")
}
- if (ls >= 0) {
+ }
+ _conl("\tprefix: " ((p in _UIDPFX ? _UIDPFX[p] "'" : "-")))
+ _conl("\tsuffix: " ((p in _UIDSFX ? _UIDSFX[p] "'" : "-")))
+ _conl("\tcounters: " (cn = (p in _UIDCNT ? _UIDCNT[p] "'" : "-")))
+ if (cn != "-") {
+ _conl("\t\tcntrL: " _UIDCNTL[_UIDCNT[p]] "'")
+ _conl("\t\tcntrH: " _UIDCNTH[_UIDCNT[p]] "'")
+ }
+ _conl("\tcharset: " (ch = (p in _UIDCHR ? _UIDCHR[p] "'" : "-")))
+ if (ch != "-") {
+ _conl("chrH: ")
+ _conl(_dumparr(_UIDCHRH[_UIDCHR[p]]))
+ _conl()
+ _conl("chrL: ")
+ _conl(_dumparr(_UIDCHRL[_UIDCHR[p]]))
+ _conl()
+ }
+}
+
+#_______________________________________________________________________
+function _dumparr(A, t, lv, a)
+{
+ ############################################
+ b = PROCINFO["sorted_in"]
+ PROCINFO["sorted_in"] = "_lengthsort"
+ if (isarray(A)) {
+ delete _DUMPARR
+ _dumparrc = _dumparrd = ""
+ _dumparr_i1(A, lv = ((lv == "" ? 16 : (lv == 0 || lv + 0 != 0 ? lv : (lv == "-*" ? -3 : (lv ~ /^\+?\*$/ ? 3 : 16))))) + 0, (lv < 0 ? -1 : 1), 0, _tabtospc(t))
+ PROCINFO["sorted_in"] = a
+ return _retarrd(_DUMPARR, _dumparrd, _dumparrd = "")
+ }
+}
+
+#___________________________________________________________
+function _dumparr_i1(A, lv, ls, ln, t, t2, i, a, f)
+{
+ t2 = _getchrln(" ", length(t))
+ if (ln == lv) {
+ if (ls > 0) {
for (i in A) {
- if (! isarray(A[i])) {
- if (length(_dumparrd = _dumparrd ((f ? t2 : t _nop(f = 1))) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) {
- _DUMPARR[++_dumparrc] = _dumparrd
- _dumparrd = ""
- }
- }
+ ++a
}
- }
- for (i in A) {
- if (isarray(A[i])) {
- _dumparr_i1(A[i], lv, ls, ln + ls, _th0((f ? t2 : t), f = 1) "[" i "]")
+ } else {
+ for (i in A) {
+ (isarray(A[i]) ? ++a : "")
}
}
- if (! f) {
- if (length(_dumparrd = _dumparrd t _CHR["EOL"]) > 262144) {
- _DUMPARR[++_dumparrc] = _dumparrd
- _dumparrd = ""
- }
+ if (length(_dumparrd = _dumparrd t ((a > 0 ? " ... (x" a ")" : "")) _CHR["EOL"]) > 262144) {
+ _DUMPARR[++_dumparrc] = _dumparrd
+ _dumparrd = ""
}
+ return
}
-
- function _dumpobj(p, f, t, s)
- {
- s = _dumpobj_i0(p, f, t = t "." p "{")
- if (p = _rFCHLD(p)) {
- return (s = s _dumpobjm(p, f, (s ? _getchrln(" ", length(t) - 1) : t " ")))
+ if (ls >= 0) {
+ for (i in A) {
+ if (! isarray(A[i])) {
+ if (length(_dumparrd = _dumparrd ((f ? t2 : t _nop(f = 1))) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) {
+ _DUMPARR[++_dumparrc] = _dumparrd
+ _dumparrd = ""
+ }
+ }
}
- return s
}
-
- function _dumpobj_i0(p, f, t)
- {
- if (f == "") {
- return _dumpobj_i2(p, t)
+ for (i in A) {
+ if (isarray(A[i])) {
+ _dumparr_i1(A[i], lv, ls, ln + ls, _th0((f ? t2 : t), f = 1) "[" i "]")
}
- if (f == 0) {
- return _dumpobj_i1(p, t " ")
+ }
+ if (! f) {
+ if (length(_dumparrd = _dumparrd t _CHR["EOL"]) > 262144) {
+ _DUMPARR[++_dumparrc] = _dumparrd
+ _dumparrd = ""
}
- return (_dumpobj_i1(p, t " ") _dumpobj_i2(p, _getchrln(" ", length(t))))
}
+}
- function _dumpobj_i1(p, t)
- {
- return _ln(t substr(((p in _tPREV ? "\253" _tPREV[p] : "")) " ", 1, 7) " " substr(((p in _tPARENT ? "\210" _tPARENT[p] : "")) " ", 1, 7) " " substr(((p in _tFCHLD ? _tFCHLD[p] : "")) "\205" ((p in _tQCHLD ? " (" _tQCHLD[p] ") " : "\205")) "\205" ((p in _tLCHLD ? _tLCHLD[p] : "")) " ", 1, 22) substr(((p in _tNEXT ? "\273" _tNEXT[p] : "")) " ", 1, 8))
+#___________________________________________________________________________________
+####################################################################################
+
+
+#___________________________________________________________________________________
+# OTHER tFUNCTIONs #################################################################
+
+#_____________________________________________________________________________
+function _dumpobj(p, f, t, s)
+{
+ ###################################################
+ s = _dumpobj_i0(p, f, t = t "." p "{")
+ if (p = _rFCHLD(p)) {
+ return (s = s _dumpobjm(p, f, (s ? _getchrln(" ", length(t) - 1) : t " ")))
}
+ return s
+}
- function _dumpobj_i2(p, t)
- {
- return (_dumpobj_i3(_[p], t " ") _dumpobj_i3(_ptr[p], _getchrln(" ", length(t)) "`", "`"))
+#___________________________________________________________
+function _dumpobj_i0(p, f, t)
+{
+ if (f == "") {
+ return _dumpobj_i2(p, t)
}
+ if (f == 0) {
+ return _dumpobj_i1(p, t " ")
+ }
+ return (_dumpobj_i1(p, t " ") _dumpobj_i2(p, _getchrln(" ", length(t))))
+}
+
+#___________________________________________________________
+function _dumpobj_i1(p, t)
+{
+ return _ln(t substr(((p in _tPREV ? "\253" _tPREV[p] : "")) " ", 1, 7) " " substr(((p in _tPARENT ? "\210" _tPARENT[p] : "")) " ", 1, 7) " " substr(((p in _tFCHLD ? _tFCHLD[p] : "")) "\205" ((p in _tQCHLD ? " (" _tQCHLD[p] ") " : "\205")) "\205" ((p in _tLCHLD ? _tLCHLD[p] : "")) " ", 1, 22) substr(((p in _tNEXT ? "\273" _tNEXT[p] : "")) " ", 1, 8))
+}
- function _dumpobj_i3(A, t, p, e, s, i, t2)
- {
- if (isarray(A)) {
+#___________________________________________________________
+function _dumpobj_i2(p, t)
+{
+ return (_dumpobj_i3(_[p], t " ") _dumpobj_i3(_ptr[p], _getchrln(" ", length(t)) "`", "`"))
+}
+
+#___________________________________________________________
+function _dumpobj_i3(A, t, p, e, s, i, t2)
+{
+ if (isarray(A)) {
+ for (i in A) {
+ t2 = _getchrln(" ", length(t))
for (i in A) {
- t2 = _getchrln(" ", length(t))
- for (i in A) {
- if (isarray(A[i])) {
- s = s _dumpobj_i3(A[i], t "[" _dumpobj_i4(i) "]", p, _ln())
- } else {
- s = s _ln(t "[" _dumpobj_i4(i) "]=" p _dumpobj_i4(A[i]) "'")
- }
- t = t2
+ if (isarray(A[i])) {
+ s = s _dumpobj_i3(A[i], t "[" _dumpobj_i4(i) "]", p, _ln())
+ } else {
+ s = s _ln(t "[" _dumpobj_i4(i) "]=" p _dumpobj_i4(A[i]) "'")
}
- return s
+ t = t2
}
- return ((e == "" ? "" : t e))
+ return s
}
- if (A == 0 && A == "") {
- return
- }
- return _ln(t "=" _dumpobj_i4(p A) "'")
+ return ((e == "" ? "" : t e))
}
-
- function _dumpobj_i4(t)
- {
- if (length(t) > 64) {
- return (substr(t, 1, 28) " ... " substr(t, length(t) - 28))
- }
- return t
- }
-
- function _dumpobj_nc(p, f, t)
- {
- return _dumpobj_i0(p, f, t "." p "{ ")
+ if (A == 0 && A == "") {
+ return
}
-
- function _dumpobjm(p, f, t, s, t2)
- {
- t2 = _getchrln(" ", length(t))
- do {
- s = s _dumpobj(p, f, t)
- t = t2
- } while (p = _rNEXT(p))
- return s
+ return _ln(t "=" _dumpobj_i4(p A) "'")
+}
+
+#___________________________________________________________
+function _dumpobj_i4(t)
+{
+ if (length(t) > 64) {
+ return (substr(t, 1, 28) " ... " substr(t, length(t) - 28))
+ }
+ return t
+}
+
+#_________________________________________________________________
+function _dumpobj_nc(p, f, t)
+{
+ #######################################
+ return _dumpobj_i0(p, f, t "." p "{ ")
+}
+
+#_________________________________________________________________
+function _dumpobjm(p, f, t, s, t2)
+{
+ ###################################
+ t2 = _getchrln(" ", length(t))
+ do {
+ s = s _dumpobj(p, f, t)
+ t = t2
+ } while (p = _rNEXT(p))
+ return s
+}
+
+#_________________________________________________________________
+function _dumpobjm_nc(p, f, t, s, t2)
+{
+ ################################
+ t2 = _getchrln(" ", length(t))
+ do {
+ s = s _dumpobj_nc(p, f, t)
+ t = t2
+ } while (p = _rNEXT(p))
+ return s
+}
+
+function _dumpuidgen(p, pd, pc, ps)
+{
+ _conline("#" ++cntdm ": " p "'")
+ _conl()
+ if (p in _tuidel) {
+ _conl("DEL: " _var(pd = _tuidel[p]))
+ _conl(_dumparr(_tUIDEL[pd]) _ln())
+ }
+ _conl("PFX: " _tUIDPFX[p] "'")
+ _conl("SFX: " _tUIDSFX[p] "'")
+ _conl("COUNT: " ((p in _tuidcnt ? (pc = _tuidcnt[p]) "'" : _th0("-", pc = -2))))
+ _con("CHARS: ")
+ if (p in _tuidchr) {
+ _conl((ps = _tuidchr[p]) "'")
+ _conl("HCHR: " ((pc == -2 ? "-" : _tUIDCNTH[pc] "'")))
+ _conl(_dumparr(_tUIDCHRH[ps]) _ln())
+ _conl("LCHR: " ((pc == -2 ? "-" : _tUIDCNTL[pc] "'")))
+ _conl(_dumparr(_tUIDCHRL[ps]) _ln())
+ } else {
+ _conl("-")
+ }
+}
+
+#_____________________________________________________________________________
+function _dumpval(v, n)
+{
+ _dumpstr = _dumpstr (v = _ln(((n == 0 && n == "" ? "RET" : n)) ": " ((v == 0 && v == "" ? "-" : v "'"))))
+ return v
+}
+
+########################################################
+
+function _eXTFN(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ return t
+ #___________________________________________________________
+
+ case "_lib_APPLY":
+ return
+ #___________________________________________________________
+
+ case "_lib_HELP":
+ return
+ #___________________________________________________________
+
+ case "_lib_NAMEVER":
+ return _ln("_extfn 1.0")
+ #___________________________________________________________
+
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+
+ case "_lib_END":
+ return
}
-
- function _dumpobjm_nc(p, f, t, s, t2)
- {
- t2 = _getchrln(" ", length(t))
- do {
- s = s _dumpobj_nc(p, f, t)
- t = t2
- } while (p = _rNEXT(p))
- return s
+}
+
+#_________________________________________________________________
+function _endpass(t)
+{
+ _endpass_v0 = t
+}
+
+#_______________________________________________________________________
+function _err(t, a, b)
+{
+ ###################################################
+ a = BINMODE
+ b = ORS
+ BINMODE = "rw"
+ ORS = ""
+ print(t) > _SYS_STDERR
+ fflush(_SYS_STDERR)
+ BINMODE = a
+ ORS = b
+ return t
+}
+
+#_________________________________________________________________
+function _errnl(t)
+{
+ ################################################
+ return _err(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])))
+}
+
+#_______________________________________________________________________
+function _error(t, d, A)
+{
+ #################################################
+ if (_ERRLOG_EF) {
+ A["TYPE"] = "ERROR"
+ A["TEXT"] = t
+ _log(A, d)
+ }
+}
+
+#_______________________________________________________________________
+function _exit(c)
+{
+ #######################################################
+ exit c
+}
+
+#_____________________________________________________________________________
+function _export_data(t, i, A)
+{
+ #################################################
+ A["DATA"] = t
+ A["ID"] = i
+ _expout("_DATA: " _Zexparr(A) "\n")
+}
+
+#___________________________________________________________________________________
+####################################################################################
+
+#_____________________________________________________________________________
+function _expout(t, d, a, b)
+{
+ ####################################################
+ a = BINMODE
+ b = ORS
+ BINMODE = "rw"
+ ORS = ""
+ print(t) > ((d ? d : d = _errlog_file))
+ fflush(d)
+ BINMODE = a
+ ORS = b
+}
+
+#_________________________________________________________________________________________
+##########################################################################################
+
+
+
+
+
+
+
+
+function _extfn_init()
+{
+ ##############################################################
+
+ _formatstrs_init()
+ _formatstrd_init()
+ _formatrexp_init()
+ _unformatstr_init()
+ _mac_init()
+}
+
+function _faccl_i0(A, t, p, P, f, r)
+{
+ f = r = ""
+ if (isarray(A)) {
+ while (f = A[f]) {
+ r = (@f(t, p, P)) r
+ }
+ }
+ return r
+}
+
+function _faccr_i0(A, t, p, P, f, r)
+{
+ f = r = ""
+ if (isarray(A)) {
+ while (f = A[f]) {
+ r = r @f(t, p, P)
+ }
+ }
+ return r
+}
+
+#_______________________________________________________________________
+function _fatal(t, d, A)
+{
+ #################################################
+ if (_ERRLOG_FF) {
+ A["TYPE"] = "FATAL"
+ A["TEXT"] = t
+ _log(A, d)
+ }
+ if (! d) {
+ exit
+ }
+}
+
+function _fbaccl(A, t, p, P)
+{
+ return _faccl_i0(A["B"], t, p, P)
+}
+
+function _fbaccr(A, t, p, P)
+{
+ return _faccr_i0(A["B"], t, p, P)
+}
+
+function _ffaccl(A, t, p, P)
+{
+ return _faccl_i0(A["F"], t, p, P)
+}
+
+function _ffaccr(A, t, p, P)
+{
+ return _faccr_i0(A["F"], t, p, P)
+}
+
+##################
+#_______________________________________________________________________
+function _fframe(A, t, p)
+{
+ #################################################
+ return _fframe_i0(A, t, p, A[""])
+}
+
+#___________________________________________________________
+function _fframe_i0(A, t, p, f)
+{
+ return ((f ? (@f(t, p)) _fframe_i0(A, t, p, A[f]) : ""))
+}
+
+#_________________________________________________________________
+function _file(f)
+{
+ #################################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
-
- function _dumpuidgen(p, pd, pc, ps)
- {
- _conline("#" ++cntdm ": " p "'")
- _conl()
- if (p in _tuidel) {
- _conl("DEL: " _var(pd = _tuidel[p]))
- _conl(_dumparr(_tUIDEL[pd]) _ln())
- }
- _conl("PFX: " _tUIDPFX[p] "'")
- _conl("SFX: " _tUIDSFX[p] "'")
- _conl("COUNT: " ((p in _tuidcnt ? (pc = _tuidcnt[p]) "'" : _th0("-", pc = -2))))
- _con("CHARS: ")
- if (p in _tuidchr) {
- _conl((ps = _tuidchr[p]) "'")
- _conl("HCHR: " ((pc == -2 ? "-" : _tUIDCNTH[pc] "'")))
- _conl(_dumparr(_tUIDCHRH[ps]) _ln())
- _conl("LCHR: " ((pc == -2 ? "-" : _tUIDCNTL[pc] "'")))
- _conl(_dumparr(_tUIDCHRL[ps]) _ln())
+ return ((f in _FILEXT ? _FILEXT[f] : ""))
+}
+
+#_______________________________________________________________________
+function _file_check(p)
+{
+ if (1 || "AGENT" in _[p]) {
+ _tframe("_file_check_i0", p, p)
+ }
+}
+
+#_______________________________________________
+function _file_check_i0(p, pp, p1, p2, f, v)
+{
+ if (_[p]["TYPE"] == "defile") {
+ f = _[p]["FILE"]
+ f = ((match(f, /^.:/) ? "" : _[_[pp]["AGENT"]][".Install Path"] "\\")) _[p]["FILE"]
+ if ("RQVERSION" in _[p]) {
+ v = _[p]["RQVERSION"]
} else {
- _conl("-")
+ v = _[pp][".Product Version"]
}
- }
-
- function _dumpval(v, n)
- {
- _dumpstr = _dumpstr (v = _ln(((n == 0 && n == "" ? "RET" : n)) ": " ((v == 0 && v == "" ? "-" : v "'"))))
- return v
- }
-
- function _eXTFN(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_extfn 1.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
+ ERRNO = ""
+ if (_th1(_[p]["DATA"] = _rdfile(f), ERRNO)) {
+ delete _[p]["DATA"]
+ return _dllerr(p, "read file: " ERRNO, f)
+ }
+ if (v != "" && v != (_[p]["VERSION"] = _getfilever(f))) {
+ return _dllerr(p, " file version mismatch: ==`" _[p]["VERSION"] "'; !=`" v "'", f)
+ }
+ _creport(p, substr("OK: FILE DETECTED" ((v == "" ? "" : "(" v ")")) ": " f, 1, 122))
+ } else {
+ if (_[p]["TYPE"] == "defdir") {
+ if (_filexist(f = _[p]["DIR"])) {
+ _creport(p, substr("OK: DIR DETECTED: " f, 1, 112))
+ } else {
+ _dllerr(p, "directory " f " is not detected")
+ }
}
}
+}
- function _endpass(t)
- {
- _endpass_v0 = t
- }
-
- function _err(t, a, b)
- {
- a = BINMODE
- b = ORS
- BINMODE = "rw"
- ORS = ""
- print(t) > _SYS_STDERR
- fflush(_SYS_STDERR)
- BINMODE = a
- ORS = b
- return t
+#_________________________________________________________________
+function _filed(f, dd, d)
+{
+ ##########################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
-
- function _errnl(t)
- {
- return _err(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])))
+ if (f in _FILEDIRFL) {
+ return _FILEDIR[f]
}
-
- function _error(t, d, A)
- {
- if (_ERRLOG_EF) {
- A["TYPE"] = "ERROR"
- A["TEXT"] = t
- _log(A, d)
+ if (f in _FILEROOT) {
+ if (d = filegetdrvdir(_FILEROOT[f])) {
+ _FILEDIRFL[f]
}
+ return (_FILEDIR[f] = d _FILEDIR[f])
}
-
- function _exit(c)
- {
- exit c
+ if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEDIR) {
+ return _FILEDIR[dd, f]
}
-
- function _export_data(t, i, A)
- {
- A["DATA"] = t
- A["ID"] = i
- _expout("_DATA: " _Zexparr(A) "\n")
+ if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) {
+ return (_FILEDIR[dd, f] = d)
}
+ return d
+}
- function _expout(t, d, a, b)
- {
- a = BINMODE
- b = ORS
- BINMODE = "rw"
- ORS = ""
- print(t) > ((d ? d : d = _errlog_file))
- fflush(d)
- BINMODE = a
- ORS = b
+#_________________________________________________________________
+function _filen(f)
+{
+ ################################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
+ return ((f in _FILENAM ? _FILENAM[f] : ""))
+}
- function _extfn_init()
- {
- _formatstrs_init()
- _formatstrd_init()
- _formatrexp_init()
- _unformatstr_init()
- _mac_init()
+#_________________________________________________________________
+function _filene(f)
+{
+ ###############################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
+ return (((f in _FILENAM ? _FILENAM[f] : "")) ((f in _FILEXT ? _FILEXT[f] : "")))
+}
- function _faccl_i0(A, t, p, P, f, r)
- {
- f = r = ""
- if (isarray(A)) {
- while (f = A[f]) {
- r = (@f(t, p, P)) r
- }
- }
- return r
+#_________________________________________________________________
+function _filenotexist(f, a)
+{
+ ######################################
+ if (f == "") {
+ return ""
}
-
- function _faccr_i0(A, t, p, P, f, r)
- {
- f = r = ""
- if (isarray(A)) {
- while (f = A[f]) {
- r = r @f(t, p, P)
- }
- }
- return r
+ if ((a = _filepath(f)) == "") {
+ ERRNO = "Filepath error `" f "'"
+ return ""
}
-
- function _fatal(t, d, A)
- {
- if (_ERRLOG_FF) {
- A["TYPE"] = "FATAL"
- A["TEXT"] = t
- _log(A, d)
- }
- if (! d) {
- exit
- }
+ _cmd("if exist \"" a "\" exit 1 2>NUL")
+ if (_exitcode == 1) {
+ return (ERRNO = _NOP)
}
+ return a
+}
- function _fbaccl(A, t, p, P)
- {
- return _faccl_i0(A["B"], t, p, P)
+#_______________________________________________________________________
+function _filepath(f, dd)
+{
+ ################################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
+ return (filegetrootdir(f, dd) ((f in _FILENAM ? _FILENAM[f] : "")) ((f in _FILEXT ? _FILEXT[f] : "")))
+}
- function _fbaccr(A, t, p, P)
- {
- return _faccr_i0(A["B"], t, p, P)
+#_________________________________________________________________
+function _filer(f, dd)
+{
+ #############################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
-
- function _ffaccl(A, t, p, P)
- {
- return _faccl_i0(A["F"], t, p, P)
+ if (f in _FILEROOT) {
+ return _FILEROOT[f]
}
-
- function _ffaccr(A, t, p, P)
- {
- return _faccr_i0(A["F"], t, p, P)
+ if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) {
+ return _FILEROOT[dd, f]
}
+ return (_FILEROOT[dd, f] = fileri(dd))
+}
- function _fframe(A, t, p)
- {
- return _fframe_i0(A, t, p, A[""])
+#_________________________________________________________________
+function _filerd(f, dd)
+{
+ ############################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
+ return filegetrootdir(f, dd)
+}
- function _fframe_i0(A, t, p, f)
- {
- return ((f ? (@f(t, p)) _fframe_i0(A, t, p, A[f]) : ""))
+#_________________________________________________________________
+function _filerdn(f, dd)
+{
+ ###########################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
+ return ((f in _FILENAM ? filegetrootdir(f, dd) _FILENAM[f] : ""))
+}
- function _file(f)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- return ((f in _FILEXT ? _FILEXT[f] : ""))
+#_________________________________________________________________
+function _filerdne(f, dd)
+{
+ ##########################################
+ if ((f = _filerdnehnd(f)) == "") {
+ return ""
}
-
- function _file_check(p)
- {
- if (1 || "AGENT" in _[p]) {
- _tframe("_file_check_i0", p, p)
- }
+ if (f in _FILENAM) {
+ return (filegetrootdir(f, dd) _FILENAM[f] ((f in _FILEXT ? _FILEXT[f] : "")))
+ }
+ if (f in _FILEXT) {
+ return (filegetrootdir(f, dd) _FILEXT[f])
}
+ return ""
+}
- function _file_check_i0(p, pp, p1, p2, f, v)
- {
- if (_[p]["TYPE"] == "defile") {
- f = _[p]["FILE"]
- f = ((match(f, /^.:/) ? "" : _[_[pp]["AGENT"]][".Install Path"] "\\")) _[p]["FILE"]
- if ("RQVERSION" in _[p]) {
- v = _[p]["RQVERSION"]
+#___________________________________________________________
+function _filerdnehnd(st, c, r, d, n, A)
+{
+ if (st) {
+ if ((c = toupper(st)) in _FILECACHE) {
+ FLENGTH = length(st)
+ return _FILECACHE[c]
+ }
+ if (match(st, /^[ \t]*\\[ \t]*\\/)) {
+ if (match(substr(st, (FLENGTH = RLENGTH) + 1), /^[ \t]*([0-9A-Za-z\-]+)[ \t]*(\\[ \t]*([A-Za-z])[ \t]*\$[ \t]*)?(\\[ \t]*([0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+[ \t]*)?(([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)) {
+ FLENGTH = FLENGTH + RLENGTH
+ d = ((A[3] ? "\\" A[3] "$" : "")) A[4]
+ gsub(/[ \t]*\\[ \t]*/, "\\", d)
+ if ((st = toupper((r = "\\\\" A[1]) d (n = A[8]))) in _FILECACHE) {
+ return (_FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st])
+ }
+ _FILEDIR[c = _FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st] = ++_file_rootcntr] = d
+ _FILEDIRFL[c]
+ _FILEROOT[c] = r
} else {
- v = _[pp][".Product Version"]
+ FLENGTH = 0
+ _filepath_err = "UNC"
+ return ""
+ }
+ } else {
+ match(st, /^(([ \t]*\.[ \t]*\\[ \t]*)|(([ \t]*([A-Za-z])[ \t]*(\:)[ \t]*)?([ \t]*(\\)[ \t]*)?))([ \t]*(([ \t]*[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+)[ \t]*)?([ \t]*([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)
+ if (! (FLENGTH = RLENGTH)) {
+ return ""
}
- ERRNO = ""
- if (_th1(_[p]["DATA"] = _rdfile(f), ERRNO)) {
- delete _[p]["DATA"]
- return _dllerr(p, "read file: " ERRNO, f)
+ d = A[8] A[10]
+ gsub(/[ \t]*\\[ \t]*/, "\\", d)
+ if ((st = toupper((r = A[5] A[6]) d (n = A[14]))) in _FILECACHE) {
+ return (_FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st])
}
- if (v != "" && v != (_[p]["VERSION"] = _getfilever(f))) {
- return _dllerr(p, " file version mismatch: ==`" _[p]["VERSION"] "'; !=`" v "'", f)
+ _FILEDIR[c = _FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st] = ++_file_rootcntr] = d
+ if (A[8]) {
+ _FILEDIRFL[c]
}
- _creport(p, substr("OK: FILE DETECTED" ((v == "" ? "" : "(" v ")")) ": " f, 1, 122))
- } else {
- if (_[p]["TYPE"] == "defdir") {
- if (_filexist(f = _[p]["DIR"])) {
- _creport(p, substr("OK: DIR DETECTED: " f, 1, 112))
- } else {
- _dllerr(p, "directory " f " is not detected")
- }
+ if (r) {
+ _FILEROOT[c] = r
}
}
- }
-
- function _filed(f, dd, d)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- if (f in _FILEDIRFL) {
- return _FILEDIR[f]
- }
- if (f in _FILEROOT) {
- if (d = filegetdrvdir(_FILEROOT[f])) {
- _FILEDIRFL[f]
+ if (n) {
+ if (match(n, /\.[^\.]*$/)) {
+ _FILEXT[c] = substr(n, RSTART)
+ _FILENAM[c] = substr(n, 1, RSTART - 1)
+ } else {
+ _FILENAM[c] = n
}
- return (_FILEDIR[f] = d _FILEDIR[f])
- }
- if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEDIR) {
- return _FILEDIR[dd, f]
- }
- if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) {
- return (_FILEDIR[dd, f] = d)
}
- return d
+ return c
}
+ return ""
+}
- function _filen(f)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- return ((f in _FILENAM ? _FILENAM[f] : ""))
+#_______________________________________________________________________
+function _filexist(f, a)
+{
+ ################################################
+ if (f == "") {
+ return ""
}
-
- function _filene(f)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- return (((f in _FILENAM ? _FILENAM[f] : "")) ((f in _FILEXT ? _FILEXT[f] : "")))
+ if ((a = _filepath(f)) == "") {
+ ERRNO = "Filepath error `" f "'"
+ return ""
}
-
- function _filenotexist(f, a)
- {
- if (f == "") {
- return ""
- }
- if ((a = _filepath(f)) == "") {
- ERRNO = "Filepath error `" f "'"
- return ""
- }
- _cmd("if exist \"" a "\" exit 1 2>NUL")
- if (_exitcode == 1) {
- return (ERRNO = _NOP)
- }
+ _cmd("if exist \"" a "\" exit 1 2>NUL")
+ if (_exitcode == 1) {
return a
}
-
- function _filepath(f, dd)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
+ ERRNO = "File not found `" f "'"
+ return _NOP
+}
+
+#_______________________________________________________________________
+function _fn(f, p0, p1, p2)
+{
+ ################################################
+ if (f in FUNCTAB) {
+ return @f(p0, p1, p2)
+ }
+}
+
+#_______________________________________________________________________
+function _foreach(A, f, r, p0, p1, p2, i, p)
+{
+ ####################################
+ if (isarray(A)) {
+ _TMP0[p = _n()]["."] = 1
+ _foreach_i0(A, f, _TMP0[p], p0, p1, p2)
+ return _th0(_retarr(_TMP0[p]), _tdel(p))
+ }
+ if (_isptr(A)) {
+ _TMP0[p = _n()][_ARRLEN] = 1
+ _tframe4("_foreach_i1" ((r ? "~" r : "")), A, f, _TMP0[p], p0, p1)
+ return _th0(_retarr(_TMP0[p]), _tdel(p))
+ }
+}
+
+#_____________________________________________________
+function _foreach_i0(A, f, D, p0, p1, p2)
+{
+ for (i in A) {
+ if (isarray(A[i])) {
+ _foreach_i0(A[i], f, D, p0, p1, p2)
+ } else {
+ _gen(D, @f(A[i], p0, p1, p2))
}
- return (filegetrootdir(f, dd) ((f in _FILENAM ? _FILENAM[f] : "")) ((f in _FILEXT ? _FILEXT[f] : "")))
}
+}
- function _filer(f, dd)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- if (f in _FILEROOT) {
- return _FILEROOT[f]
- }
- if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) {
- return _FILEROOT[dd, f]
- }
- return (_FILEROOT[dd, f] = fileri(dd))
- }
+#_____________________________________________________
+function _foreach_i1(p, f, D, p0, p1, p2)
+{
+ _gen(D, @f(p, p0, p1, p2))
+}
- function _filerd(f, dd)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- return filegetrootdir(f, dd)
+#_____________________________________________________________________________
+function _formatrexp(t)
+{
+ _formatstrq0 = split(t, _FORMATSTRA, /[\/\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
+ _formatstrs0 = ""
+ for (t = 1; t < _formatstrq0; t++) {
+ _formatstrs0 = _formatstrs0 _FORMATSTRA[t] _FORMATREXPESC[_FORMATSTRB[t]]
}
+ return (_formatstrs0 _FORMATSTRA[t])
+}
- function _filerdn(f, dd)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- return ((f in _FILENAM ? filegetrootdir(f, dd) _FILENAM[f] : ""))
- }
+#___________________________________________________________
+function _formatrexp_init()
+{
+ _defescarr(_FORMATREXPESC, "[\\x00-\\x1F\\x80-\\xFF]", _QASC)
+ _defescarr(_FORMATREXPESC, "\\/", "\\")
+ _FORMATREXPESC["\t"] = "\\t"
+}
- function _filerdne(f, dd)
- {
- if ((f = _filerdnehnd(f)) == "") {
- return ""
- }
- if (f in _FILENAM) {
- return (filegetrootdir(f, dd) _FILENAM[f] ((f in _FILEXT ? _FILEXT[f] : "")))
- }
- if (f in _FILEXT) {
- return (filegetrootdir(f, dd) _FILEXT[f])
- }
- return ""
+#_____________________________________________________________________________
+function _formatstrd(t)
+{
+ _formatstrq0 = split(t, _FORMATSTRA, /["\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
+ _formatstrs0 = ""
+ for (t = 1; t < _formatstrq0; t++) {
+ _formatstrs0 = _formatstrs0 _FORMATSTRA[t] _FORMATSTRDESC[_FORMATSTRB[t]]
}
+ return (_formatstrs0 _FORMATSTRA[t])
+}
+
+#___________________________________________________________
+function _formatstrd_init()
+{
+ _defescarr(_FORMATSTRDESC, "[\\x00-\\x1F\\x80-\\xFF]", _QASC)
+ _defescarr(_FORMATSTRDESC, "[\\\\\"]", "\\")
+ _FORMATSTRDESC["\t"] = "\\t"
+}
+
+#__________________________________________________________________________________
+####################################################################################
+
- function _filerdnehnd(st, c, r, d, n, A)
- {
- if (st) {
- if ((c = toupper(st)) in _FILECACHE) {
- FLENGTH = length(st)
- return _FILECACHE[c]
- }
- if (match(st, /^[ \t]*\\[ \t]*\\/)) {
- if (match(substr(st, (FLENGTH = RLENGTH) + 1), /^[ \t]*([0-9A-Za-z\-]+)[ \t]*(\\[ \t]*([A-Za-z])[ \t]*\$[ \t]*)?(\\[ \t]*([0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+[ \t]*)?(([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)) {
- FLENGTH = FLENGTH + RLENGTH
- d = ((A[3] ? "\\" A[3] "$" : "")) A[4]
- gsub(/[ \t]*\\[ \t]*/, "\\", d)
- if ((st = toupper((r = "\\\\" A[1]) d (n = A[8]))) in _FILECACHE) {
- return (_FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st])
- }
- _FILEDIR[c = _FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st] = ++_file_rootcntr] = d
- _FILEDIRFL[c]
- _FILEROOT[c] = r
- } else {
- FLENGTH = 0
- _filepath_err = "UNC"
- return ""
- }
- } else {
- match(st, /^(([ \t]*\.[ \t]*\\[ \t]*)|(([ \t]*([A-Za-z])[ \t]*(\:)[ \t]*)?([ \t]*(\\)[ \t]*)?))([ \t]*(([ \t]*[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+)[ \t]*)?([ \t]*([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)
- if (! (FLENGTH = RLENGTH)) {
- return ""
- }
- d = A[8] A[10]
- gsub(/[ \t]*\\[ \t]*/, "\\", d)
- if ((st = toupper((r = A[5] A[6]) d (n = A[14]))) in _FILECACHE) {
- return (_FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st])
- }
- _FILEDIR[c = _FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st] = ++_file_rootcntr] = d
- if (A[8]) {
- _FILEDIRFL[c]
- }
- if (r) {
- _FILEROOT[c] = r
- }
- }
- if (n) {
- if (match(n, /\.[^\.]*$/)) {
- _FILEXT[c] = substr(n, RSTART)
- _FILENAM[c] = substr(n, 1, RSTART - 1)
- } else {
- _FILENAM[c] = n
- }
- }
- return c
- }
- return ""
- }
- function _filexist(f, a)
- {
- if (f == "") {
- return ""
- }
- if ((a = _filepath(f)) == "") {
- ERRNO = "Filepath error `" f "'"
- return ""
- }
- _cmd("if exist \"" a "\" exit 1 2>NUL")
- if (_exitcode == 1) {
- return a
- }
- ERRNO = "File not found `" f "'"
- return _NOP
- }
- function _fn(f, p0, p1, p2)
- {
- if (f in FUNCTAB) {
- return @f(p0, p1, p2)
- }
+#___________________________________________________________________________________
+function _formatstrs(t)
+{
+ _formatstrq0 = split(t, _FORMATSTRA, /['\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
+ _formatstrs0 = ""
+ for (t = 1; t < _formatstrq0; t++) {
+ _formatstrs0 = _formatstrs0 _FORMATSTRA[t] _FORMATSTRSESC[_FORMATSTRB[t]]
}
-
- function _foreach(A, f, r, p0, p1, p2, i, p)
- {
- if (isarray(A)) {
- _TMP0[p = _n()]["."] = 1
- _foreach_i0(A, f, _TMP0[p], p0, p1, p2)
- return _th0(_retarr(_TMP0[p]), _tdel(p))
- }
- if (_isptr(A)) {
- _TMP0[p = _n()][_ARRLEN] = 1
- _tframe4("_foreach_i1" ((r ? "~" r : "")), A, f, _TMP0[p], p0, p1)
- return _th0(_retarr(_TMP0[p]), _tdel(p))
+ return (_formatstrs0 _FORMATSTRA[t])
+}
+
+#___________________________________________________________
+function _formatstrs_init()
+{
+ _defescarr(_FORMATSTRSESC, "[\\x00-\\x1F\\x80-\\xFF]", _QASC)
+ _defescarr(_FORMATSTRSESC, "[\\\\']", "\\")
+ _FORMATSTRSESC["\t"] = "\\t"
+}
+
+function _fpp(q, D, S)
+{
+ _conl()
+ _conline(q)
+ _conl()
+ q = _patharr0(S, q)
+ #_arregpath(D,S)
+ #_conl(_dumparr(D))
+ _conl(_dumparr(S))
+ _conl()
+ return q
+}
+
+#_______________________________________________________________________
+########################################################################
+
+
+
+
+
+
+
+
+
+function _fthru(A, c, p, B)
+{
+ return _fthru_i0(A, c, p, B, A[""])
+}
+
+#_________________________________________________________________
+function _fthru_i0(A, c, p, B, f)
+{
+ return ((f ? @f(c, _fthru_i0(A, c, p, B, A[f]), B) : ""))
+}
+
+function _gen(D, t)
+{
+ if (length(D[D[_ARRLEN]] = D[D["."]] t) > _datablock_length) {
+ D[++D[_ARRLEN]] = ""
+ }
+}
+
+#_____________________________________________________________________________
+function _gensubfn(t, r, f, p0, A)
+{
+ ###############################################
+ if (match(t, r, A)) {
+ return (substr(t, 1, RSTART - 1) (@f(_th0(substr(t, RSTART, RLENGTH), t = substr(t, RSTART + RLENGTH)), A, p0)) _gensubfn(t, r, f, p0))
+ }
+ return t
+}
+
+#_____________________________________________________________________________
+function _get_errout(p)
+{
+ #######################################################
+ return _tframe("_get_errout_i0", p)
+}
+
+#_______________________________________________________________________
+function _get_errout_i0(p, t, n, a)
+{
+ return ((p in _tLOG ? _get_errout_i1(p) _get_errout_i3(p) : ""))
+}
+
+#_________________________________________________________________
+function _get_errout_i1(p, t, n, a)
+{
+ if (p in _tLOG) {
+ n = ""
+ if (_tLOG[p]["TYPE"]) {
+ n = _tLOG[p]["TYPE"] ": " _get_errout_i2(p)
+ if (match(_tLOG[p]["TEXT"], /\x1F/)) {
+ t = n
+ gsub(/[^\t]/, " ", t)
+ return (_ln(n substr(_tLOG[p]["TEXT"], 1, RSTART - 1)) _ln(t substr(_tLOG[p]["TEXT"], RSTART + 1)))
+ }
}
- }
+ return _ln(n _tLOG[p]["TEXT"])
+ }
+}
+
+#_______________________________________________________________________
+function _get_errout_i2(p)
+{
+ return (("FILE" in _tLOG[p] ? _tLOG[p]["FILE"] (("LINE" in _tLOG[p] ? "(" _tLOG[p]["LINE"] ")" : "")) ": " : ""))
+}
+
+#_______________________________________________________________________
+function _get_errout_i3(p, t, ts, cl, cp, cr, a, b)
+{
+ if ("LSTR" in _tLOG[p]) {
+ t = _tLOG[p]["FULLSTR"]
+ ts = _tLOG[p]["TS"]
+ cp = "^"
+ if ("CSTR" in _tLOG[p]) {
+ cr = _tLOG[p]["CSTR"]
+ cl = _tLOG[p]["CLSTR"]
+ if ("CPSTR" in _tLOG[p]) {
+ cp = _tLOG[p]["CPSTR"]
+ }
+ }
+ cr = substr(cr, length(cl) + length(cp) + 1)
+ return (_ln(_tabtospc(t, ts)) _ln(_getchrln(" ", a = length(_tabtospc(_tLOG[p]["LSTR"], ts))) _getchrln("-", b = length(_tabtospc(cl, ts, a))) _getchrln("^", b = length(_tabtospc(cp, ts, a = a + b))) _getchrln("-", length(_tabtospc(cr, ts, a + b)))))
+ }
+}
- function _foreach_i0(A, f, D, p0, p1, p2)
- {
- for (i in A) {
- if (isarray(A[i])) {
- _foreach_i0(A[i], f, D, p0, p1, p2)
- } else {
- _gen(D, @f(A[i], p0, p1, p2))
+#_____________________________________________________________________________
+function _get_logout(p)
+{
+ #######################################################
+ return _tframe("_get_logout_i0", p)
+}
+
+#_______________________________________________________________________
+function _get_logout_i0(p, t, n, a)
+{
+ if (p in _tLOG) {
+ n = (("DATE" in _tLOG[p] ? _tLOG[p]["DATE"] " " : "")) (("TIME" in _tLOG[p] ? _tLOG[p]["TIME"] " " : ""))
+ if (_tLOG[p]["TYPE"]) {
+ n = n _tLOG[p]["TYPE"] ": " (("FILE" in _tLOG[p] ? _tLOG[p]["FILE"] (("LINE" in _tLOG[p] ? "(" _tLOG[p]["LINE"] ")" : "")) ": " : ""))
+ if (match(_tLOG[p]["TEXT"], /\x1F/)) {
+ t = n
+ gsub(/[^\t]/, " ", t)
+ return (_ln(n substr(_tLOG[p]["TEXT"], 1, RSTART - 1)) _ln(t substr(_tLOG[p]["TEXT"], RSTART + 1)))
+ }
+ }
+ return _ln(n _tLOG[p]["TEXT"])
+ }
+}
+
+#_______________________________________________________________________
+function _getchrln(s, w)
+{
+ #################################################
+ if (s == "") {
+ return
+ }
+ #if ( w!=w+0 || w<0 ) w=_CON_WIDTH
+ if (length(s) < w) {
+ if (s in _GETCHRLN) {
+ if (length(_getchrlnt0 = _GETCHRLN[s]) >= w) {
+ return substr(_getchrlnt0, 1, w)
}
- }
+ } else {
+ _getchrlnt0 = s s
+ }
+ while (length(_getchrlnt0) < w) {
+ _getchrlnt0 = _getchrlnt0 _getchrlnt0
+ }
+ _GETCHRLN[s] = _getchrlnt0
+ return substr(_getchrlnt0, 1, w)
+ } else {
+ return substr(s, 1, w)
+ }
+}
+
+#_______________________________________________________________________
+function _getdate()
+{
+ #####################################################
+ return strftime("%F")
+}
+
+#_____________________________________________________________________________
+function _getfilepath(t, f, al, b, A)
+{
+ ############################################
+ ERRNO = ""
+ if (match(t, /^[ \t]*(("([^"]*)"[ \t]*)|([`']([^']*)'[ \t]*)|(([^ \t]+)[ \t]*))/, A)) {
+ al = RLENGTH
+ f = A[3] A[5] A[7]
+ _conl("_getfilepath(" f ") (" al ")")
+ if (b = _filepath(f)) {
+ if (length(f) <= FLENGTH) {
+ FLENGTH = al
+ return b
+ }
+ ERRNO = "Filepath `" f "' error"
+ }
+ }
+ FLENGTH = 0
+}
+
+function _getfilever(f)
+{
+ #############################################################
+ split(_cmd(_fileverpath " \"" f "\""), _GETFILEVERA0, /[ \t]+/)
+ if (_GETFILEVERA0[5]) {
+ return _GETFILEVERA0[5]
+ }
+}
+
+#_________________________________________________________________
+function _getime()
+{
+ ################################################
+ return strftime("%H:%M:%S")
+}
+
+#_________________________________________________________________
+function _getmpdir(f, dd)
+{
+ ##########################################
+ if (! dd || ! (dd = _filerd(dd))) {
+ dd = _FILEIO_TMPRD
+ }
+ if (f = (f ? _filerd(f, dd) : _filerd("_" ++_FILEIO_TMPCNTR "\\", dd))) {
+ _FILEIO_RDTMP[toupper(f)]
+ }
+ return f
+}
+
+#_________________________________________________________________
+function _getmpfile(f, dd)
+{
+ #########################################
+ if (! dd || ! (dd = _filerd(dd))) {
+ dd = _FILEIO_TMPRD
+ }
+ if (f = _filerdne((_filene(f) ? f : f "_" ++_FILEIO_TMPCNTR), dd)) {
+ _FILEIO_RDNETMP[toupper(f)]
+ }
+ return f
+}
+
+#_______________________________________________________________________
+function _getperf(o, t, a)
+{
+ ###############################################
+ (o == "" ? ++_getperf_opcurr : _getperf_opcurr = o)
+ if ((a = _getsecond()) != _getperf_last) {
+ _getperf_opsec = (_getperf_opcurr - _getperf_opstart) / ((_getperf_last = a) - _getperf_start)
+ return @_getperf_fn(o, t, a)
+ }
+ return 1
+}
+
+#___________________________________________________________
+function _getperf_(o, t, a)
+{
+ if (a >= _getperf_end) {
+ return 0
}
-
- function _foreach_i1(p, f, D, p0, p1, p2)
- {
- _gen(D, @f(p, p0, p1, p2))
+ if (_getperf_opsecp != _getperf_opsec) {
+ _constat(((_constatstr == _getperf_stat ? _getperf_statstr : _getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]")
+ _getperf_stat = _constatstr
+ }
+ return 1
+}
+
+#___________________________________________________________
+function _getperf_noe(o, t, a)
+{
+ if (_getperf_opsecp != _getperf_opsec) {
+ _constat(((_constatstr == _getperf_stat ? _getperf_statstr : _getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]")
+ _getperf_stat = _constatstr
+ }
+ return 1
+}
+
+#___________________________________________________________
+function _getperf_noenot(o, t, a)
+{
+ return 1
+}
+
+#___________________________________________________________
+function _getperf_not(o, t, a)
+{
+ if (a < _getperf_end) {
+ return 1
}
+}
- function _formatrexp(t)
- {
- _formatstrq0 = split(t, _FORMATSTRA, /[\/\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
- _formatstrs0 = ""
- for (t = 1; t < _formatstrq0; t++) {
- _formatstrs0 = _formatstrs0 _FORMATSTRA[t] _FORMATREXPESC[_FORMATSTRB[t]]
- }
- return (_formatstrs0 _FORMATSTRA[t])
- }
+#_________________________________________________________________________________________
+##########################################################################################
- function _formatrexp_init()
- {
- _defescarr(_FORMATREXPESC, "[\\x00-\\x1F\\x80-\\xFF]", _QASC)
- _defescarr(_FORMATREXPESC, "\\/", "\\")
- _FORMATREXPESC["\t"] = "\\t"
- }
- function _formatstrd(t)
- {
- _formatstrq0 = split(t, _FORMATSTRA, /["\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
- _formatstrs0 = ""
- for (t = 1; t < _formatstrq0; t++) {
- _formatstrs0 = _formatstrs0 _FORMATSTRA[t] _FORMATSTRDESC[_FORMATSTRB[t]]
- }
- return (_formatstrs0 _FORMATSTRA[t])
- }
- function _formatstrd_init()
- {
- _defescarr(_FORMATSTRDESC, "[\\x00-\\x1F\\x80-\\xFF]", _QASC)
- _defescarr(_FORMATSTRDESC, "[\\\\\"]", "\\")
- _FORMATSTRDESC["\t"] = "\\t"
- }
- function _formatstrs(t)
- {
- _formatstrq0 = split(t, _FORMATSTRA, /['\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
- _formatstrs0 = ""
- for (t = 1; t < _formatstrq0; t++) {
- _formatstrs0 = _formatstrs0 _FORMATSTRA[t] _FORMATSTRSESC[_FORMATSTRB[t]]
- }
- return (_formatstrs0 _FORMATSTRA[t])
- }
- function _formatstrs_init()
- {
- _defescarr(_FORMATSTRSESC, "[\\x00-\\x1F\\x80-\\xFF]", _QASC)
- _defescarr(_FORMATSTRSESC, "[\\\\']", "\\")
- _FORMATSTRSESC["\t"] = "\\t"
- }
- function _fpp(q, D, S)
- {
- _conl()
- _conline(q)
- _conl()
- q = _patharr0(S, q)
- _conl(_dumparr(S))
- _conl()
- return q
- }
- function _fthru(A, c, p, B)
- {
- return _fthru_i0(A, c, p, B, A[""])
- }
- function _fthru_i0(A, c, p, B, f)
- {
- return ((f ? @f(c, _fthru_i0(A, c, p, B, A[f]), B) : ""))
- }
- function _gen(D, t)
- {
- if (length(D[D[_ARRLEN]] = D[D["."]] t) > _datablock_length) {
- D[++D[_ARRLEN]] = ""
- }
- }
- function _gensubfn(t, r, f, p0, A)
- {
- if (match(t, r, A)) {
- return (substr(t, 1, RSTART - 1) (@f(_th0(substr(t, RSTART, RLENGTH), t = substr(t, RSTART + RLENGTH)), A, p0)) _gensubfn(t, r, f, p0))
- }
- return t
- }
- function _get_errout(p)
- {
- return _tframe("_get_errout_i0", p)
- }
- function _get_errout_i0(p, t, n, a)
- {
- return ((p in _tLOG ? _get_errout_i1(p) _get_errout_i3(p) : ""))
- }
- function _get_errout_i1(p, t, n, a)
- {
- if (p in _tLOG) {
- n = ""
- if (_tLOG[p]["TYPE"]) {
- n = _tLOG[p]["TYPE"] ": " _get_errout_i2(p)
- if (match(_tLOG[p]["TEXT"], /\x1F/)) {
- t = n
- gsub(/[^\t]/, " ", t)
- return (_ln(n substr(_tLOG[p]["TEXT"], 1, RSTART - 1)) _ln(t substr(_tLOG[p]["TEXT"], RSTART + 1)))
- }
- }
- return _ln(n _tLOG[p]["TEXT"])
- }
- }
- function _get_errout_i2(p)
- {
- return (("FILE" in _tLOG[p] ? _tLOG[p]["FILE"] (("LINE" in _tLOG[p] ? "(" _tLOG[p]["LINE"] ")" : "")) ": " : ""))
- }
- function _get_errout_i3(p, t, ts, cl, cp, cr, a, b)
- {
- if ("LSTR" in _tLOG[p]) {
- t = _tLOG[p]["FULLSTR"]
- ts = _tLOG[p]["TS"]
- cp = "^"
- if ("CSTR" in _tLOG[p]) {
- cr = _tLOG[p]["CSTR"]
- cl = _tLOG[p]["CLSTR"]
- if ("CPSTR" in _tLOG[p]) {
- cp = _tLOG[p]["CPSTR"]
- }
- }
- cr = substr(cr, length(cl) + length(cp) + 1)
- return (_ln(_tabtospc(t, ts)) _ln(_getchrln(" ", a = length(_tabtospc(_tLOG[p]["LSTR"], ts))) _getchrln("-", b = length(_tabtospc(cl, ts, a))) _getchrln("^", b = length(_tabtospc(cp, ts, a = a + b))) _getchrln("-", length(_tabtospc(cr, ts, a + b)))))
- }
- }
- function _get_logout(p)
- {
- return _tframe("_get_logout_i0", p)
- }
- function _get_logout_i0(p, t, n, a)
- {
- if (p in _tLOG) {
- n = (("DATE" in _tLOG[p] ? _tLOG[p]["DATE"] " " : "")) (("TIME" in _tLOG[p] ? _tLOG[p]["TIME"] " " : ""))
- if (_tLOG[p]["TYPE"]) {
- n = n _tLOG[p]["TYPE"] ": " (("FILE" in _tLOG[p] ? _tLOG[p]["FILE"] (("LINE" in _tLOG[p] ? "(" _tLOG[p]["LINE"] ")" : "")) ": " : ""))
- if (match(_tLOG[p]["TEXT"], /\x1F/)) {
- t = n
- gsub(/[^\t]/, " ", t)
- return (_ln(n substr(_tLOG[p]["TEXT"], 1, RSTART - 1)) _ln(t substr(_tLOG[p]["TEXT"], RSTART + 1)))
- }
- }
- return _ln(n _tLOG[p]["TEXT"])
- }
- }
- function _getchrln(s, w)
- {
- if (s == "") {
- return
- }
- if (length(s) < w) {
- if (s in _GETCHRLN) {
- if (length(_getchrlnt0 = _GETCHRLN[s]) >= w) {
- return substr(_getchrlnt0, 1, w)
- }
- } else {
- _getchrlnt0 = s s
- }
- while (length(_getchrlnt0) < w) {
- _getchrlnt0 = _getchrlnt0 _getchrlnt0
- }
- _GETCHRLN[s] = _getchrlnt0
- return substr(_getchrlnt0, 1, w)
- } else {
- return substr(s, 1, w)
- }
- }
- function _getdate()
- {
- return strftime("%F")
- }
- function _getfilepath(t, f, al, b, A)
- {
- ERRNO = ""
- if (match(t, /^[ \t]*(("([^"]*)"[ \t]*)|([`']([^']*)'[ \t]*)|(([^ \t]+)[ \t]*))/, A)) {
- al = RLENGTH
- f = A[3] A[5] A[7]
- _conl("_getfilepath(" f ") (" al ")")
- if (b = _filepath(f)) {
- if (length(f) <= FLENGTH) {
- FLENGTH = al
- return b
- }
- ERRNO = "Filepath `" f "' error"
+
+function _getreg_i1(D, r, R, a, i, il, ir, rc, B)
+{
+ a = IGNORECASE
+ IGNORECASE = 1
+ r = "^" _torexp(r)
+ rc = 0
+ zs = ""
+ for (i in R) {
+ if (match(i, r, B)) {
+ il = B[_torexp_pfxcntr]
+ ir = gensub(/....$/, "", 1, substr(i, 1 + B[_torexp_pfxcntr, "length"]))
+ if (! gsub(/^\\/, "", ir) && match(il, /[^\\]+$/)) {
+ ir = substr(il, RSTART) ir
}
+ D[ir] = R[i]
+ rc++
}
- FLENGTH = 0
}
-
- function _getfilever(f)
- {
- split(_cmd(_fileverpath " \"" f "\""), _GETFILEVERA0, /[ \t]+/)
- if (_GETFILEVERA0[5]) {
- return _GETFILEVERA0[5]
- }
+ IGNORECASE = a
+ if (rc > 0) {
+ return rc
}
+}
- function _getime()
- {
- return strftime("%H:%M:%S")
- }
+#_________________________________________________________________
+function _getsecond()
+{
+ #############################################
+ return systime()
+}
- function _getmpdir(f, dd)
- {
- if (! dd || ! (dd = _filerd(dd))) {
- dd = _FILEIO_TMPRD
- }
- if (f = (f ? _filerd(f, dd) : _filerd("_" ++_FILEIO_TMPCNTR "\\", dd))) {
- _FILEIO_RDTMP[toupper(f)]
- }
- return f
+#___________________________________________________________
+function _getsecondsync(a, c, b, c2)
+{
+ ##########################
+ a = systime()
+ while (a == systime()) {
+ ++c
}
+ return (a + 1)
+}
- function _getmpfile(f, dd)
- {
- if (! dd || ! (dd = _filerd(dd))) {
- dd = _FILEIO_TMPRD
+#_______________________________________________________________________
+function _getuid(p)
+{
+ ################################################# 1 #
+ if (p in _UIDOBL) {
+ for (_tptr in _UIDOBLV[_getuida0 = _UIDOBL[p]]) {
+ delete _UIDOBLV[_getuida0][_tptr]
+ _CLASSPTR[_tptr] = p
+ return _tptr
}
- if (f = _filerdne((_filene(f) ? f : f "_" ++_FILEIO_TMPCNTR), dd)) {
- _FILEIO_RDNETMP[toupper(f)]
- }
- return f
}
+ _CLASSPTR[_tptr = _UIDPFX[p] _getuid_i0(_UIDCNT[p], _UIDCHRL[_tptr = _UIDCHR[p]], _UIDCHRH[_tptr]) _UIDSFX[p]] = p
+ return _tptr
+}
- function _getperf(o, t, a)
- {
- (o == "" ? ++_getperf_opcurr : _getperf_opcurr = o)
- if ((a = _getsecond()) != _getperf_last) {
- _getperf_opsec = (_getperf_opcurr - _getperf_opstart) / ((_getperf_last = a) - _getperf_start)
- return @_getperf_fn(o, t, a)
+#_____________________________________________________
+function _getuid_i0(p, UL, UH)
+{
+ if ("" == (_tptr = UL[_UIDCNTL[p]])) {
+ for (_tptr in UH) {
+ delete UH[_tptr]
+ return ((_UIDCNTH[p] = _tptr) (_UIDCNTL[p] = UL[""]))
}
- return 1
+ _fatal("out of UID")
}
+ return (_UIDCNTH[p] (_UIDCNTL[p] = _tptr))
+}
- function _getperf_(o, t, a)
- {
- if (a >= _getperf_end) {
- return 0
- }
- if (_getperf_opsecp != _getperf_opsec) {
- _constat(((_constatstr == _getperf_stat ? _getperf_statstr : _getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]")
- _getperf_stat = _constatstr
- }
- return 1
- }
+function _handle8494(t)
+{
+ return gensub(/(.)/, ".\\1", "G", t)
+}
- function _getperf_noe(o, t, a)
- {
- if (_getperf_opsecp != _getperf_opsec) {
- _constat(((_constatstr == _getperf_stat ? _getperf_statstr : _getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]")
- _getperf_stat = _constatstr
- }
- return 1
+#_____________________________________________________________________________
+function _hexnum(n, l)
+{
+ #########################################################
+ if (l + 0 < 1) {
+ l = 2
}
+ return sprintf("%." ((l + 0 < 1 ? 2 : l)) "X", n)
+}
- function _getperf_noenot(o, t, a)
- {
- return 1
+#_________________________________________________________________
+function _igetperf(t, s, o)
+{
+ ######################################### # t-test period in seconds(==0 ? no period; s(=true/false)-output/not output status; o-qnt of ops before test start
+ if (t == 0 && t == "" && s == 0 && s == "" && o == 0 && o == "") {
+ if (_getperf_fn !~ /not$/ && _constatstr == _getperf_stat) {
+ _constat(_getperf_statstr)
+ }
+ _getperf_fn = "_nop"
+ return ("[TIME=" (_getperf_last - _getperf_start) " sec(" _getperf_opsec " ops/sec)]")
+ }
+ _conl("initiate _getperf")
+ _getperf_opstart = _getperf_opcurr = o + 0
+ _getperf_opsec = _getperf_opsecp = _getperf_stat = _getperf_statstr = ""
+ _getperf_end = t + (_getperf_start = _getperf_last = _getsecondsync())
+ _getperf_fn = ((t + 0 > 0 ? "_getperf_" : "_getperf_noe")) ((s ? "" : "not"))
+ return _getperf_start
+}
+
+function _import_data(t, p, p2, a)
+{
+ if (match(t, /^_DATA: /)) {
+ _tDATA[a = _wLCHLD(p, _N())][""]
+ delete _tDATA[a][""]
+ _Zimparr(_tDATA[a], substr(t, 8))
+ _conl("DATA: `" _tDATA[a]["ID"] "':`" _tDATA[a]["DATA"] "'")
+ return ""
}
-
- function _getperf_not(o, t, a)
- {
- if (a < _getperf_end) {
- return 1
+ return t
+}
+
+#_______________________________________________________________________
+function _info(t, d, A)
+{
+ ##################################################
+ if (_ERRLOG_IF) {
+ A["TYPE"] = "INFO"
+ A["TEXT"] = t
+ _log(A, d)
+ }
+}
+
+# test with the different path types
+# _conl(_ln("SRC:") _dumparr(S)); _conl();
+
+function _ini(p, cs, dptr, pfx, sfx, hstr, lstr)
+{
+ return _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A)
+}
+
+function _initfilever()
+{
+ _fileverpath = "\\\\CPU\\eGAWK\\LIB\\_filever\\_filever.exe"
+}
+
+function _initrdreg()
+{
+ _RDREGTYPE["SZ"] = "STR"
+ _RDREGTYPE["DWORD"] = "W32"
+ _RDREGTYPE["QWORD"] = "W64"
+ _RDREGTYPE["BINARY"] = "BIN"
+ _RDREGTYPE["EXPAND_SZ"] = "XSZ"
+ _RDREGTYPE["MULTI_SZ"] = "MSZ"
+ _RDrdregfld = _rdregkey = 0
+}
+
+function _initregpath0()
+{
+ _REGPATH0REGDIR[""] = "HKEY_LOCAL_MACHINE"
+ _REGPATH0REGDIR["HKLM"] = "HKEY_LOCAL_MACHINE"
+ _REGPATH0REGDIR["HKEY_LOCAL_MACHINE"] = "HKEY_LOCAL_MACHINE"
+ _REGPATH0REGDIR["HKCR"] = "HKEY_CLASSES_ROOT"
+ _REGPATH0REGDIR["HKEY_CLASSES_ROOT"] = "HKEY_CLASSES_ROOT"
+ _REGPATH0REGDIR["HKCU"] = "HKEY_CURRENT_USER"
+ _REGPATH0REGDIR["HKEY_CURRENT_USER"] = "HKEY_CURRENT_USER"
+ _REGPATH0REGDIR["HKU"] = "HKEY_USERS"
+ _REGPATH0REGDIR["HKEY_USERS"] = "HKEY_USERS"
+ _REGPATH0REGDIR["HKCC"] = "HKEY_CURRENT_CONFIG"
+ _REGPATH0REGDIR["HKEY_CURRENT_CONFIG"] = "HKEY_CURRENT_CONFIG"
+ _REGPATH0REGDIR["HKPD"] = "HKEY_PERFORMANCE_DATA"
+ _REGPATH0REGDIR["HKEY_PERFORMANCE_DATA"] = "HKEY_PERFORMANCE_DATA"
+}
+
+function _initshare()
+{
+ _sharextool = "\\\\CPU\\eGAWK\\LIB\\_share\\_share.exe"
+}
+
+#_________________________________________
+function _initspecialuid()
+{
+ _NOINDEX = _getuid()
+ _LEN = _getuid()
+ _PTR = _getuid()
+ _NAME = _getuid()
+ _TYPE = _getuid()
+ _FORMAT = _getuid()
+}
+
+function _initsys()
+{
+}
+
+#_______________________________________________________________________
+function _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A)
+{
+ ################### 1 #
+ if (cs == 0 && cs == "") {
+ cs = p
+ p = _getuid()
+ }
+ _conl()
+ _conl()
+ _conl(cs)
+ if (match(cs, /^(([^:]*):)?(([^'\xB4]*\xB4.)*[^'\xB4]*)[']/, A)) {
+ pfx = A[3]
+ dptr = A[2]
+ }
+ if (match(cs = substr(cs, 1 + RLENGTH), /'(([^'\xB4]*\xB4.)*[^'\xB4]*)$/, A)) {
+ sfx = A[1]
+ cs = substr(cs, 1, RSTART - 1)
+ }
+ if (match(cs, /^(([`\^])(.*))/, A)) {
+ if (A[2] == "`") {
+ hstr = A[3] "~"
+ lstr = ""
+ } else {
+ lstr = A[3] "+"
+ hstr = ""
+ }
+ } else {
+ if (match(cs, /^(([^'\xB4\|]*\xB4.)*[^'\xB4\|]*)(\|(.*))?/, A)) {
+ hstr = A[1]
+ lstr = A[4]
+ } else {
+ ERRNO = "_inituid(): bad parameters"
+ return
}
}
-
- function _getreg_i1(D, r, R, a, i, il, ir, rc, B)
- {
- a = IGNORECASE
- IGNORECASE = 1
- r = "^" _torexp(r)
- rc = 0
- zs = ""
- for (i in R) {
- if (match(i, r, B)) {
- il = B[_torexp_pfxcntr]
- ir = gensub(/....$/, "", 1, substr(i, 1 + B[_torexp_pfxcntr, "length"]))
- if (! gsub(/^\\/, "", ir) && match(il, /[^\\]+$/)) {
- ir = substr(il, RSTART) ir
+ _conl(dptr ":" pfx "'" hstr "|" lstr "'" sfx)
+ return _cfguid(p, dptr, pfx, sfx, hstr, lstr)
+}
+
+function _inituidefault(h, l, H, L)
+{
+ _classys = ""
+ delete _UIDOBLV[_UIDOBLV[_UIDOBL[_classys] = _classys][""] = _classys][""]
+ _UIDPFX[_classys]
+ _UIDSFX[_classys]
+ _UIDCNT[_classys] = _UIDCHR[_classys] = _CLASSPTR[_classys] = _classys
+ h = "AB"
+ l = h "01"
+ _splitstr(H, h)
+ _splitstr(L, l)
+ delete _UIDCHRH[_UIDCHRH[_classys][""] = _classys][""]
+ delete _UIDCHRL[_UIDCHRL[_classys][""] = _classys][""]
+ _UIDCNTH[_classys]
+ _cfguidh(_classys, H, L)
+ _UIDCNTL[_classys] = _cfguidl(_classys, L, L)
+ _CLASSFN[_classys]["del"] = "_tobjDEL"
+ _CLASSFN[_classys]["new"] = "_tobjNEW"
+ _drawuid(_classys)
+ _initspecialuid()
+}
+
+#_______________________________________________________________________
+function _ins(S, sf, D, df)
+{
+ ################################################
+ if (sf in S) {
+ if (isarray(S[sf])) {
+ if (df in D) {
+ if (isarray(D[df])) {
+ return _extarr(D[df], S[sf])
}
- D[ir] = R[i]
- rc++
+ delete D[df]
}
- }
- IGNORECASE = a
- if (rc > 0) {
- return rc
- }
+ D[df][""]
+ delete D[df][""]
+ return _extarr(D[df], S[sf])
+ } else {
+ if (isarray(D[df])) {
+ delete D[df]
+ }
+ D[df] = S[sf] D[df]
+ }
+ }
+}
+
+#_________________________________________________________________
+function _insf(A, f)
+{
+ ###############################################
+ A["F"][""] = A["B"][A["F"][f] = A["F"][""]] = f
+}
+
+#_________________________________________________________________
+function _insframe(A, f)
+{
+ ###########################################
+ A[f] = A[""]
+ A[""] = f
+}
+
+########################
+#_________________________________________________________________
+function _inspass(A, f)
+{
+ A[f] = A[""]
+ A[""] = f
+}
+
+# there is problem with string's format: i can;t easilly merge 2 charsets: comma-divided and every-char-divided strings
+
+#_______________________________________________________________________
+function _isptr(p)
+{
+ ################################################## 1 #
+ if (isarray(p)) {
+ is = _NOP
+ it = "A"
+ return 0
}
-
- function _getsecond()
- {
- return systime()
+ is = p
+ if (p == 0 && p == "") {
+ it = "-"
+ return 0
}
-
- function _getsecondsync(a, c, b, c2)
- {
- a = systime()
- while (a == systime()) {
- ++c
- }
- return (a + 1)
+ if (p in _CLASSPTR) {
+ return (it = "P")
}
+ it = "S"
+ return 0
+}
- function _getuid(p)
- {
- if (p in _UIDOBL) {
- for (_tptr in _UIDOBLV[_getuida0 = _UIDOBL[p]]) {
- delete _UIDOBLV[_getuida0][_tptr]
- _CLASSPTR[_tptr] = p
- return _tptr
- }
+#_______________________________________________________________________
+function _istr(p)
+{
+ ################################################### 1 #
+ if (isarray(p)) {
+ is = _NOP
+ it = "A"
+ return 0
+ }
+ is = p
+ if (p == 0 && p == "") {
+ it = "-"
+ return 0
+ }
+ return (it = (p == "" ? "s" : "S"))
+}
+
+#_________________________________________________________________
+function _lengthsort(i1, v1, i2, v2)
+{
+ ##############################
+ return ((length(i1) < length(i2) ? -1 : (length(i1) > length(i2) ? 1 : (i1 < i2 ? -1 : 1))))
+}
+
+#_________________________________________________________________
+function _lib_APPLY()
+{
+ return _ffaccr(_LIBAPI, "_lib_APPLY")
+}
+
+#_________________________________________________________________
+function _lib_BEGIN(A)
+{
+ return _ffaccr(_LIBAPI, "_lib_BEGIN", "", A)
+}
+
+#_______________________________________________________________________
+function _lib_CMDLN(t)
+{
+ return _pass(_LIBAPI["F"], "_lib_CMDLN", t)
+}
+
+#_________________________________________________________________
+function _lib_END(A)
+{
+ return _ffaccr(_LIBAPI, "_lib_END", "", A)
+}
+
+#_________________________________________________________________
+function _lib_HELP()
+{
+ return _fbaccr(_LIBAPI, "_lib_HELP")
+}
+
+#_________________________________________________________________
+function _lib_NAMEVER()
+{
+ return _fbaccr(_LIBAPI, "_lib_NAMEVER")
+}
+
+#_____________________________________________________________________________
+function _ln(t)
+{
+ ###############################################################
+ return ((t ~ /\x0A$/ ? t : t _CHR["EOL"]))
+}
+
+#_________________________________________________________________
+function _log(A, p, a, B)
+{
+ ###########################################
+ if (isarray(A)) {
+ A["TIME"] = _getime()
+ A["DATE"] = _getdate()
+ if (p) {
+ _tLOG[p = _wLCHLD(p, _N())][""]
+ delete _tLOG[p][""]
+ _movarr(_tLOG[p], A)
+ return p
}
- _CLASSPTR[_tptr = _UIDPFX[p] _getuid_i0(_UIDCNT[p], _UIDCHRL[_tptr = _UIDCHR[p]], _UIDCHRH[_tptr]) _UIDSFX[p]] = p
- return _tptr
+ _expout("_ERRLOG: " _Zexparr(A) "\n")
+ } else {
+ B["TEXT"] = A
+ B["TYPE"] = ""
+ return _log(B, p)
}
+}
- function _getuid_i0(p, UL, UH)
- {
- if ("" == (_tptr = UL[_UIDCNTL[p]])) {
- for (_tptr in UH) {
- delete UH[_tptr]
- return ((_UIDCNTH[p] = _tptr) (_UIDCNTL[p] = UL[""]))
+#_________________________________________________________________
+function _lspctab(t, ts, l, l1, l2, A)
+{
+ ################################
+ while (match(t, /^(\t*)( *)((\t*)(.*))$/, A)) {
+ if (A[1, "length"] >= l) {
+ return substr(t, l + 1)
+ }
+ if (A[2]) {
+ if ((l1 = int(A[2, "length"] / ts)) >= (l2 = l - A[1, "length"])) {
+ return (substr(A[2], l2 * ts + 1) A[3])
}
- _fatal("out of UID")
+ if (! A[4]) {
+ return A[5]
+ }
+ t = A[1] _getchrln("\t", l1) A[3]
+ } else {
+ return t
}
- return (_UIDCNTH[p] (_UIDCNTL[p] = _tptr))
}
-
- function _handle8494(t)
- {
- return gensub(/(.)/, ".\\1", "G", t)
+}
+
+function _mac_init()
+{
+ _MACPFX["\204"] = "_macpfx84"
+ _MACPFX[""] = "_mpupfxsubret"
+ _MACPFX84SFX["\204"] = "_macpfx84"
+ _MACPFX84SFX["\224"] = "_macsfx94"
+ _MACPFX84SFX[""] = "_mpusfxsubret"
+ _VLDMAXSTRING = 1e+06
+}
+
+function _macpfx84(F, D, C, p1, p2, p3)
+{
+ return _mpusub(_MACPFX84SFX, D, C, D[_mpuptr++], p1, p2, p3)
+}
+
+function _macsfx94(F, D, C, p1, p2, p3)
+{
+ return _mpuretsub(D, _handle8494(_mpuacc))
+}
+
+#_______________________________________________________________________
+function _movarr(D, S)
+{
+ ###################################################
+ delete D
+ D[""]
+ delete D[""]
+ _addarr(D, S)
+}
+
+function _mpu(t, F, p1, p2, p3, D, C)
+{
+ if (patsplit(t, C, /[\x84\x93\x94]/, D) > 0) {
+ _conline("CODE")
+ _conl()
+ _conl(_dumparr(C))
+ _conline("DATA")
+ _conl()
+ _conl(_dumparr(D))
+ _mpuptr = 0
+ _mpucc0 = ""
+ _mpusub(F, D, C, D[_mpuptr++], p1, p2, p3)
+ return _mpuacc
}
+ return t
+}
- function _hexnum(n, l)
- {
- if (l + 0 < 1) {
- l = 2
- }
- return sprintf("%." ((l + 0 < 1 ? 2 : l)) "X", n)
- }
+#
+# /rexpstr/ -> datastr
+# (\x00\t\+)* -> 28 00 09 5B 2B 29
+#
+# unesc all non-rexp characters: replace unesc of rexp-characters but do not remove it: \* -> \*, \x2A -> \*, \052 -> \*, \\ -> \#
- function _igetperf(t, s, o)
- {
- if (t == 0 && t == "" && s == 0 && s == "" && o == 0 && o == "") {
- if (_getperf_fn !~ /not$/ && _constatstr == _getperf_stat) {
- _constat(_getperf_statstr)
- }
- _getperf_fn = "_nop"
- return ("[TIME=" (_getperf_last - _getperf_start) " sec(" _getperf_opsec " ops/sec)]")
- }
- _conl("initiate _getperf")
- _getperf_opstart = _getperf_opcurr = o + 0
- _getperf_opsec = _getperf_opsecp = _getperf_stat = _getperf_statstr = ""
- _getperf_end = t + (_getperf_start = _getperf_last = _getsecondsync())
- _getperf_fn = ((t + 0 > 0 ? "_getperf_" : "_getperf_noe")) ((s ? "" : "not"))
- return _getperf_start
- }
-
- function _import_data(t, p, p2, a)
- {
- if (match(t, /^_DATA: /)) {
- _tDATA[a = _wLCHLD(p, _N())][""]
- delete _tDATA[a][""]
- _Zimparr(_tDATA[a], substr(t, 8))
- _conl("DATA: `" _tDATA[a]["ID"] "':`" _tDATA[a]["DATA"] "'")
- return ""
- }
- return t
- }
- function _info(t, d, A)
- {
- if (_ERRLOG_IF) {
- A["TYPE"] = "INFO"
- A["TEXT"] = t
- _log(A, d)
- }
- }
- function _ini(p, cs, dptr, pfx, sfx, hstr, lstr)
- {
- return _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A)
- }
- function _initfilever()
- {
- _fileverpath = "\\\\CPU\\eGAWK\\LIB\\_filever\\_filever.exe"
- }
- function _initrdreg()
- {
- _RDREGTYPE["SZ"] = "STR"
- _RDREGTYPE["DWORD"] = "W32"
- _RDREGTYPE["QWORD"] = "W64"
- _RDREGTYPE["BINARY"] = "BIN"
- _RDREGTYPE["EXPAND_SZ"] = "XSZ"
- _RDREGTYPE["MULTI_SZ"] = "MSZ"
- _RDrdregfld = _rdregkey = 0
- }
- function _initregpath0()
- {
- _REGPATH0REGDIR[""] = "HKEY_LOCAL_MACHINE"
- _REGPATH0REGDIR["HKLM"] = "HKEY_LOCAL_MACHINE"
- _REGPATH0REGDIR["HKEY_LOCAL_MACHINE"] = "HKEY_LOCAL_MACHINE"
- _REGPATH0REGDIR["HKCR"] = "HKEY_CLASSES_ROOT"
- _REGPATH0REGDIR["HKEY_CLASSES_ROOT"] = "HKEY_CLASSES_ROOT"
- _REGPATH0REGDIR["HKCU"] = "HKEY_CURRENT_USER"
- _REGPATH0REGDIR["HKEY_CURRENT_USER"] = "HKEY_CURRENT_USER"
- _REGPATH0REGDIR["HKU"] = "HKEY_USERS"
- _REGPATH0REGDIR["HKEY_USERS"] = "HKEY_USERS"
- _REGPATH0REGDIR["HKCC"] = "HKEY_CURRENT_CONFIG"
- _REGPATH0REGDIR["HKEY_CURRENT_CONFIG"] = "HKEY_CURRENT_CONFIG"
- _REGPATH0REGDIR["HKPD"] = "HKEY_PERFORMANCE_DATA"
- _REGPATH0REGDIR["HKEY_PERFORMANCE_DATA"] = "HKEY_PERFORMANCE_DATA"
- }
- function _initshare()
- {
- _sharextool = "\\\\CPU\\eGAWK\\LIB\\_share\\_share.exe"
- }
- function _initspecialuid()
- {
- _NOINDEX = _getuid()
- _LEN = _getuid()
- _PTR = _getuid()
- _NAME = _getuid()
- _TYPE = _getuid()
- _FORMAT = _getuid()
- }
- function _initsys()
- {
- }
- function _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A)
- {
- if (cs == 0 && cs == "") {
- cs = p
- p = _getuid()
- }
- _conl()
- _conl()
- _conl(cs)
- if (match(cs, /^(([^:]*):)?(([^'\xB4]*\xB4.)*[^'\xB4]*)[']/, A)) {
- pfx = A[3]
- dptr = A[2]
- }
- if (match(cs = substr(cs, 1 + RLENGTH), /'(([^'\xB4]*\xB4.)*[^'\xB4]*)$/, A)) {
- sfx = A[1]
- cs = substr(cs, 1, RSTART - 1)
- }
- if (match(cs, /^(([`\^])(.*))/, A)) {
- if (A[2] == "`") {
- hstr = A[3] "~"
- lstr = ""
- } else {
- lstr = A[3] "+"
- hstr = ""
- }
- } else {
- if (match(cs, /^(([^'\xB4\|]*\xB4.)*[^'\xB4\|]*)(\|(.*))?/, A)) {
- hstr = A[1]
- lstr = A[4]
- } else {
- ERRNO = "_inituid(): bad parameters"
- return
- }
- }
- _conl(dptr ":" pfx "'" hstr "|" lstr "'" sfx)
- return _cfguid(p, dptr, pfx, sfx, hstr, lstr)
- }
-
- function _inituidefault(h, l, H, L)
- {
- _classys = ""
- delete _UIDOBLV[_UIDOBLV[_UIDOBL[_classys] = _classys][""] = _classys][""]
- _UIDPFX[_classys]
- _UIDSFX[_classys]
- _UIDCNT[_classys] = _UIDCHR[_classys] = _CLASSPTR[_classys] = _classys
- h = "AB"
- l = h "01"
- _splitstr(H, h)
- _splitstr(L, l)
- delete _UIDCHRH[_UIDCHRH[_classys][""] = _classys][""]
- delete _UIDCHRL[_UIDCHRL[_classys][""] = _classys][""]
- _UIDCNTH[_classys]
- _cfguidh(_classys, H, L)
- _UIDCNTL[_classys] = _cfguidl(_classys, L, L)
- _CLASSFN[_classys]["del"] = "_tobjDEL"
- _CLASSFN[_classys]["new"] = "_tobjNEW"
- _drawuid(_classys)
- _initspecialuid()
- }
-
- function _ins(S, sf, D, df)
- {
- if (sf in S) {
- if (isarray(S[sf])) {
- if (df in D) {
- if (isarray(D[df])) {
- return _extarr(D[df], S[sf])
- }
- delete D[df]
- }
- D[df][""]
- delete D[df][""]
- return _extarr(D[df], S[sf])
- } else {
- if (isarray(D[df])) {
- delete D[df]
- }
- D[df] = S[sf] D[df]
- }
- }
- }
- function _insf(A, f)
- {
- A["F"][""] = A["B"][A["F"][f] = A["F"][""]] = f
- }
- function _insframe(A, f)
- {
- A[f] = A[""]
- A[""] = f
- }
- function _inspass(A, f)
- {
- A[f] = A[""]
- A[""] = f
- }
- function _isptr(p)
- {
- if (isarray(p)) {
- is = _NOP
- it = "A"
- return 0
- }
- is = p
- if (p == 0 && p == "") {
- it = "-"
- return 0
- }
- if (p in _CLASSPTR) {
- return (it = "P")
- }
- it = "S"
- return 0
- }
- function _istr(p)
- {
- if (isarray(p)) {
- is = _NOP
- it = "A"
- return 0
- }
- is = p
- if (p == 0 && p == "") {
- it = "-"
- return 0
- }
- return (it = (p == "" ? "s" : "S"))
- }
- function _lengthsort(i1, v1, i2, v2)
- {
- return ((length(i1) < length(i2) ? -1 : (length(i1) > length(i2) ? 1 : (i1 < i2 ? -1 : 1))))
- }
- function _lib_APPLY()
- {
- return _ffaccr(_LIBAPI, "_lib_APPLY")
- }
- function _lib_BEGIN(A)
- {
- return _ffaccr(_LIBAPI, "_lib_BEGIN", "", A)
- }
- function _lib_CMDLN(t)
- {
- return _pass(_LIBAPI["F"], "_lib_CMDLN", t)
- }
- function _lib_END(A)
- {
- return _ffaccr(_LIBAPI, "_lib_END", "", A)
- }
- function _lib_HELP()
- {
- return _fbaccr(_LIBAPI, "_lib_HELP")
- }
- function _lib_NAMEVER()
- {
- return _fbaccr(_LIBAPI, "_lib_NAMEVER")
- }
- function _ln(t)
- {
- return ((t ~ /\x0A$/ ? t : t _CHR["EOL"]))
- }
- function _log(A, p, a, B)
- {
- if (isarray(A)) {
- A["TIME"] = _getime()
- A["DATE"] = _getdate()
- if (p) {
- _tLOG[p = _wLCHLD(p, _N())][""]
- delete _tLOG[p][""]
- _movarr(_tLOG[p], A)
- return p
- }
- _expout("_ERRLOG: " _Zexparr(A) "\n")
- } else {
- B["TEXT"] = A
- B["TYPE"] = ""
- return _log(B, p)
- }
- }
- function _lspctab(t, ts, l, l1, l2, A)
- {
- while (match(t, /^(\t*)( *)((\t*)(.*))$/, A)) {
- if (A[1, "length"] >= l) {
- return substr(t, l + 1)
- }
- if (A[2]) {
- if ((l1 = int(A[2, "length"] / ts)) >= (l2 = l - A[1, "length"])) {
- return (substr(A[2], l2 * ts + 1) A[3])
- }
- if (! A[4]) {
- return A[5]
- }
- t = A[1] _getchrln("\t", l1) A[3]
- } else {
- return t
- }
- }
- }
- function _mac_init()
- {
- _MACPFX["\204"] = "_macpfx84"
- _MACPFX[""] = "_mpupfxsubret"
- _MACPFX84SFX["\204"] = "_macpfx84"
- _MACPFX84SFX["\224"] = "_macsfx94"
- _MACPFX84SFX[""] = "_mpusfxsubret"
- _VLDMAXSTRING = 1e+06
- }
- function _macpfx84(F, D, C, p1, p2, p3)
- {
- return _mpusub(_MACPFX84SFX, D, C, D[_mpuptr++], p1, p2, p3)
- }
- function _macsfx94(F, D, C, p1, p2, p3)
- {
- return _mpuretsub(D, _handle8494(_mpuacc))
- }
- function _movarr(D, S)
- {
- delete D
- D[""]
- delete D[""]
- _addarr(D, S)
- }
- function _mpu(t, F, p1, p2, p3, D, C)
- {
- if (patsplit(t, C, /[\x84\x93\x94]/, D) > 0) {
- _conline("CODE")
- _conl()
- _conl(_dumparr(C))
- _conline("DATA")
- _conl()
- _conl(_dumparr(D))
- _mpuptr = 0
- _mpucc0 = ""
- _mpusub(F, D, C, D[_mpuptr++], p1, p2, p3)
- return _mpuacc
- }
- return t
- }
- function _mpudefaulthnd(F, D, C, p1, p2, p3)
- {
- _mpuretsub(D, _mpucc0)
- }
- function _mpupfxsubret(F, D, C, p1, p2, p3)
- {
- return 1
- }
- function _mpuretsub(D, t)
- {
- _mpuacc = D[_mpuptr++]
- _accmpu(D, t)
- return 1
- }
- function _mpusfxsubret(F, D, C, p1, p2, p3)
- {
- return -1
- }
+function _mpudefaulthnd(F, D, C, p1, p2, p3)
+{
+ _mpuretsub(D, _mpucc0)
+}
- function _mpusub(F, D, C, d, p1, p2, p3, q)
- {
- q = D[_ARRLEN]
- if (_VLDMAXSTRING < length(d)) {
- D[--D[_ARRLEN]] = d
- _mpuacc = ""
+function _mpupfxsubret(F, D, C, p1, p2, p3)
+{
+ return 1
+}
+
+function _mpuretsub(D, t)
+{
+ _mpuacc = D[_mpuptr++]
+ _accmpu(D, t)
+ return 1
+}
+
+function _mpusfxsubret(F, D, C, p1, p2, p3)
+{
+ return -1
+}
+
+function _mpusub(F, D, C, d, p1, p2, p3, q)
+{
+ q = D[_ARRLEN]
+ if (_VLDMAXSTRING < length(d)) {
+ D[--D[_ARRLEN]] = d
+ _mpuacc = ""
+ } else {
+ _mpuacc = d
+ }
+ d = _mpucc0
+ _conl("_mpusub enter: in `" _mpuacc "' / _mpuptr=" _mpuptr "'")
+ do {
+ if ((_mpucc0 = C[_mpuptr]) in F) {
+ if (isarray(F[_mpucc0])) {
+ _mpufn0 = F[_mpucc0]
+ }
+ _conl("FN: `" _mpucc0 "' > CALL: `" _mpufn0 "' : _mpuacc=" _mpuacc "'")
} else {
- _mpuacc = d
- }
- d = _mpucc0
- _conl("_mpusub enter: in `" _mpuacc "' / _mpuptr=" _mpuptr "'")
- do {
- if ((_mpucc0 = C[_mpuptr]) in F) {
- if (isarray(F[_mpucc0])) {
- _mpufn0 = F[_mpucc0]
- }
- _conl("FN: `" _mpucc0 "' > CALL: `" _mpufn0 "' : _mpuacc=" _mpuacc "'")
- } else {
- _mpufn0 = "_mpudefaulthnd"
+ _mpufn0 = "_mpudefaulthnd"
+ }
+ } while (! _accmpu(D, _mpuacc, @_mpufn0(F, D, C, p1, p2, p3)))
+ if (_mpufn0 == -1) {
+ _conl("WARNING: unclosed expression: `" d _mpuacc "'")
+ _mpuacc = d _mpuacc
+ }
+ _retarrm(D, q, "", (_mpufn0 == -1 ? _th0(d, _mpusubwrng("WARNING: unclosed expression", d _mpuacc)) : ""))
+ # collect: _mpuacc=_retarr(D) _mpuacc
+ _conl("mpusub exit: _mpuacc: `" _mpuacc "'")
+}
+
+#_______________________________________________________________________
+function _n(F, v, p)
+{
+ #####################################################
+ for (p in _UIDSDEL) {
+ delete _UIDSDEL[p]
+ delete _ptr[p]
+ delete _tPREV[p]
+ delete _tPARENT[p]
+ delete _tNEXT[p]
+ delete _tFCHLD[p]
+ delete _tQCHLD[p]
+ delete _tLCHLD[p]
+ delete _TMP0[p]
+ delete _TMP1[p]
+ delete _tLINK[p]
+ delete _tCLASS[p]
+ return _nN_i0(p, F, v)
+ }
+ for (p in _UIDS) {
+ delete _UIDS[p]
+ return _nN_i0(p, F, v)
+ }
+ return _nN_i0(_tgenuid(), F, v)
+}
+
+#_____________________________________________________
+function _nN_i0(p, F, v)
+{
+ _[p][""]
+ delete _[p][""]
+ _ptr[p][""]
+ delete _ptr[p][""]
+ _TMP0[p][_ARRLEN] = _TMP1[p][_ARRLEN] = 0
+ if (isarray(F)) {
+ delete F[p]
+ if (isarray(v)) {
+ F[p][""]
+ delete F[p][""]
+ _copyarr(F[p], v)
+ } else {
+ if (! (v == 0 && v == "")) {
+ F[p] = v
}
- } while (! _accmpu(D, _mpuacc, @_mpufn0(F, D, C, p1, p2, p3)))
- if (_mpufn0 == -1) {
- _conl("WARNING: unclosed expression: `" d _mpuacc "'")
- _mpuacc = d _mpuacc
}
- _retarrm(D, q, "", (_mpufn0 == -1 ? _th0(d, _mpusubwrng("WARNING: unclosed expression", d _mpuacc)) : ""))
- _conl("mpusub exit: _mpuacc: `" _mpuacc "'")
- }
-
- function _n(F, v, p)
- {
- for (p in _UIDSDEL) {
- delete _UIDSDEL[p]
- delete _ptr[p]
- delete _tPREV[p]
- delete _tPARENT[p]
- delete _tNEXT[p]
- delete _tFCHLD[p]
- delete _tQCHLD[p]
- delete _tLCHLD[p]
- delete _TMP0[p]
- delete _TMP1[p]
- delete _tLINK[p]
- delete _tCLASS[p]
- return _nN_i0(p, F, v)
- }
- for (p in _UIDS) {
- delete _UIDS[p]
- return _nN_i0(p, F, v)
- }
- return _nN_i0(_tgenuid(), F, v)
- }
-
- function _nN_i0(p, F, v)
- {
- _[p][""]
- delete _[p][""]
- _ptr[p][""]
- delete _ptr[p][""]
- _TMP0[p][_ARRLEN] = _TMP1[p][_ARRLEN] = 0
- if (isarray(F)) {
- delete F[p]
+ } else {
+ if (! (F == 0 && F == "")) {
if (isarray(v)) {
- F[p][""]
- delete F[p][""]
- _copyarr(F[p], v)
+ _[p][F][""]
+ delete _[p][F][""]
+ _copyarr(_[p][F], v)
} else {
- if (! (v == 0 && v == "")) {
- F[p] = v
- }
- }
- } else {
- if (! (F == 0 && F == "")) {
- if (isarray(v)) {
- _[p][F][""]
- delete _[p][F][""]
- _copyarr(_[p][F], v)
+ if (v == 0 && v == "") {
+ _mpu(F, p)
} else {
- if (v == 0 && v == "") {
- _mpu(F, p)
- } else {
- _[p][F] = v
- }
+ _[p][F] = v
}
}
}
- return p
}
+ return p
+}
- function _newclrdir(f)
- {
- if ((f = _filerd(f)) == "") {
- return
- }
- _cmd("rd " f " /S /Q 2>NUL")
+#_________________________________________________________________
+function _newclrdir(f)
+{
+ ############################################
+ if ((f = _filerd(f)) == "") {
+ return
+ }
+ _cmd("rd " f " /S /Q 2>NUL")
+ _cmd("md " f " 2>NUL")
+ _WFILEROOTDIR[f]
+ return f
+}
+
+#_______________________________________________________________________
+function _newdir(f)
+{
+ #####################################################
+ if ((f = _filerd(f)) == "") {
+ return
+ }
+ if (! (f in _WFILEROOTDIR)) {
_cmd("md " f " 2>NUL")
_WFILEROOTDIR[f]
- return f
}
-
- function _newdir(f)
- {
- if ((f = _filerd(f)) == "") {
+ return f
+}
+
+##############################
+#_______________________________________________________________________
+function _nop(p0, p1, p2, p3)
+{
+}
+
+#_____________________________________________________
+# _retarr(ARRAY,start,prefixtr,postfixtr)
+# Return string collected from elements of ARRAY.
+# The data elements in ARRAY have numeric indexes. By default it starts from element with index 1, but it is possible to locate elements starting from
+# 0,-1,-.... The last data element in the ARRAY have the highest numeric index that is stored in ARRAY[_ARRLEN].
+# Optimized for very large data size.
+#
+# IN: ARRAY - source data array(is ARRAY is not array then return undefined)
+# start - (optional) start index in ARRAY; if missed or have non-numeric value then start array index will be 1.
+# prefixst - the string that will be inserted in the begin of generated return string
+# postfix - the string that will be added at the end of generated return string
+# MOD: -
+# OUT: -
+# RETURN: undefined - if ARRAY is not array; if ARRAY is empty; if start is higher than ARRAY last element index
+# string - collected string: prefixtr-arraydata-postfixtr
+#_________________________________________________________________
+function _nretarr(A, i, v, r, q)
+{
+ #####################################
+ if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) {
+ if (i <= (r = q - 16)) {
+ _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
+ while (i < r) {
+ _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
+ }
+ _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
return
}
- if (! (f in _WFILEROOTDIR)) {
- _cmd("md " f " 2>NUL")
- _WFILEROOTDIR[f]
- }
- return f
- }
-
- function _nop(p0, p1, p2, p3)
- {
+ _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
+ return
}
-
- function _nretarr(A, i, v, r, q)
- {
- if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) {
- if (i <= (r = q - 16)) {
- _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
- while (i < r) {
- _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
- }
- _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
- return
- }
+ _ARRSTR = v
+ return
+}
+
+#___________________________________________________________
+function _nretarrd(A, i, v, r, q)
+{
+ ##############################
+ if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) {
+ if (i <= (r = q - 16)) {
+ _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
+ while (i < r) {
+ _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
+ }
+ _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
+ } else {
_ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
- return
}
+ } else {
_ARRSTR = v
- return
}
-
- function _nretarrd(A, i, v, r, q)
- {
- if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) {
- if (i <= (r = q - 16)) {
- _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
- while (i < r) {
- _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
+ delete A
+ A[""]
+ delete A[""]
+}
+
+#___________________________________________________________________________________
+####################################################################################
+
+#___________________________________________________________________________________
+function _out(t, a, b)
+{
+ ###############################################################
+ a = BINMODE
+ b = ORS
+ BINMODE = "rw"
+ ORS = ""
+ print(t) > _SYS_STDOUT
+ fflush(_SYS_STDOUT)
+ BINMODE = a
+ ORS = b
+ return t
+}
+
+#_________________________________________________________________
+function _outnl(t)
+{
+ ################################################
+ return _out(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])))
+}
+
+function _p1(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s1, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p2(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s2, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p3(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s3, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p4(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s4, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p5(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s5, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p6(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s6, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p7(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s7, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _p8(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ _qparamf0 = "_p" _QMAP[_qparamc1--]
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s8, p1, p2, p3, p4, p5, p6, p7)
+}
+
+#_______________________________________________________________________
+function _pass(A, f, t, p2, i, a)
+{
+ ###########################################
+ a = _endpass_v0
+ _endpass_v0 = ""
+ i = 1
+ while (t && i) {
+ i = ""
+ while ((i = A[i]) && t == (t = @i(f, t, p2))) {
+ }
+ }
+ if (i && _endpass_v0) {
+ A["!"] = 1
+ t = _endpass_v0
+ } else {
+ delete A["!"]
+ }
+ _endpass_v0 = a
+ return t
+}
+
+# this is somnitelno: that / / . / / com 56 / / - is the DEV...; what is DEV ??? this already PROBLEM
+#_____________________________________________________________________________
+function _patharr0(D, q, i, h, A, B)
+{
+ ##############################################
+ delete D
+ if (0 < (q = split(gensub(/\\/, "/", "G", gensub(/ *([:$\\\/]) */, "\\1", "G", gensub(/(^[ \t]+)|([ \t]+$)/, "", "G", q))), A, /\/+/, B))) {
+ if (2 > (h = length(B[1]))) {
+ D["type"] = "FILE"
+ A[1] = _patharr0_i0(A[1], D, "drive")
+ return _patharr0_i1(D, A, 1, q)
+ }
+ i = gensub(/ *([\.\?]) */, "\\1", "G", A[2])
+ IGNORECASE = 1
+ match(A[1], /^((https?)|(ftp)):$/)
+ IGNORECASE = 0
+ if (RLENGTH > 0) {
+ D["type"] = toupper(substr(A[1], 1, RLENGTH - 1))
+ _patharr0_i0(i, D, "site", "port")
+ } else {
+ if (A[1] == "") {
+ D["type"] = "UNC"
+ if (h > 2) {
+ D["host"]
+ A[2] = _patharr0_i0(A[2], D, "drive", "", "FILE")
+ return _patharr0_i1(D, A, 2, q)
}
- _ARRSTR = _ARRSTR A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
+ if (i == "") {
+ return 1
+ }
+ D["host"] = i
+ A[3] = _patharr0_i0(A[3], D, "drive", "", "FILE")
} else {
- _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] v _retarr_i0(A, q, i)
+ D["type"] = "FILE"
+ A[1] = _patharr0_i0(A[1], D, "drive")
+ return _patharr0_i1(D, A, 1, q)
}
- } else {
- _ARRSTR = v
}
- delete A
- A[""]
- delete A[""]
+ return _patharr0_i1(D, A, 3, q)
}
+}
- function _out(t, a, b)
- {
- a = BINMODE
- b = ORS
- BINMODE = "rw"
- ORS = ""
- print(t) > _SYS_STDOUT
- fflush(_SYS_STDOUT)
- BINMODE = a
- ORS = b
+#_____________________________________________________
+function _patharr0_i0(t, D, l, r, d, i)
+{
+ if (i = index(t, ":")) {
+ if (d) {
+ D["type"] = d
+ }
+ if (i > 1) {
+ D[l] = substr(t, 1, i - 1)
+ }
+ if ((t = substr(t, i + 1)) && r) {
+ D[r] = t
+ }
return t
+ } else {
+ if (t && r) {
+ D[l] = t
+ }
}
+ return t
+}
- function _outnl(t)
- {
- return _out(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])))
- }
-
- function _p1(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s1, p1, p2, p3, p4, p5, p6, p7)
+#_____________________________________________________
+function _patharr0_i1(D, A, i, q, t, c)
+{
+ if (D["type"] == "UNC") {
+ if (t = A[i++]) {
+ D[0] = (D["share"] = D[++c] = t) "/"
+ } else {
+ return 1
+ }
}
-
- function _p2(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s2, p1, p2, p3, p4, p5, p6, p7)
+ while (i < q) {
+ D[0] = D[0] (D[++c] = A[i++]) "/"
}
-
- function _p3(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s3, p1, p2, p3, p4, p5, p6, p7)
+ if (i == q) {
+ if (match(t = A[i], /\.[^\.]*$/)) {
+ if (RSTART > 1) {
+ D["name"] = substr(t, 1, RSTART - 1)
+ }
+ D["ext"] = substr(t, RSTART, RLENGTH)
+ } else {
+ if (t != "") {
+ D["name"] = t
+ }
+ }
}
+ return 1
+}
- function _p4(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s4, p1, p2, p3, p4, p5, p6, p7)
- }
+#############################################################################
- function _p5(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s5, p1, p2, p3, p4, p5, p6, p7)
- }
- function _p6(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s6, p1, p2, p3, p4, p5, p6, p7)
- }
- function _p7(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
+function _pmap(m, s1, s2, s3, s4, s5, s6, s7, s8)
+{
+ if (match(m, /^([^\(]+)\(([^\)]*)\)$/, _QMAP)) {
+ _qparamf1 = _QMAP[1]
+ _QMAP[0] = "r" (_qparamc1 = split(_QMAP[2], _QMAP, ""))
_qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s7, p1, p2, p3, p4, p5, p6, p7)
- }
-
- function _p8(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8, s8, p1, p2, p3, p4, p5, p6, p7)
- }
-
- function _pass(A, f, t, p2, i, a)
- {
- a = _endpass_v0
- _endpass_v0 = ""
- i = 1
- while (t && i) {
- i = ""
- while ((i = A[i]) && t == (t = @i(f, t, p2))) {
+ return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8)
+ }
+}
+
+function _pr0(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1()
+}
+
+function _pr1(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1)
+}
+
+function _pr2(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2)
+}
+
+function _pr3(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2, p3)
+}
+
+function _pr4(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2, p3, p4)
+}
+
+function _pr5(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2, p3, p4, p5)
+}
+
+function _pr6(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2, p3, p4, p5, p6)
+}
+
+function _pr7(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _pr8(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
+{
+ return @_qparamf1(p1, p2, p3, p4, p5, p6, p7, p8)
+}
+
+#_________________________________________________________________
+function _printarr(A, t, lv, r, a)
+{
+ ####################################
+ a = PROCINFO["sorted_in"]
+ PROCINFO["sorted_in"] = "_lengthsort"
+ _printarrexp = (r ? r : "")
+ if (isarray(A)) {
+ delete _DUMPARR
+ _dumparrc = _dumparrd = ""
+ _printarr_i1(A, lv = ((lv == "" ? 16 : (lv == 0 || lv + 0 != 0 ? lv : (lv == "-*" ? -3 : (lv ~ /^\+?\*$/ ? 3 : 16))))) + 0, (lv < 0 ? -1 : 1), 0, _tabtospc(t))
+ PROCINFO["sorted_in"] = a
+ return _retarrd(_DUMPARR, _dumparrd, _dumparrd = "")
+ }
+}
+
+#___________________________________________________________
+function _printarr_i1(A, lv, ls, ln, t, t2, i, a, f)
+{
+ t2 = _getchrln(" ", length(t))
+ if (ln == lv) {
+ if (ls > 0) {
+ for (i in A) {
+ ++a
}
- }
- if (i && _endpass_v0) {
- A["!"] = 1
- t = _endpass_v0
} else {
- delete A["!"]
+ for (i in A) {
+ (isarray(A[i]) ? ++a : "")
+ }
}
- _endpass_v0 = a
- return t
+ if (length(_dumparrd = _dumparrd t ((a > 0 ? " ... (x" a ")" : "")) _CHR["EOL"]) > 262144) {
+ _conl(_dumparrd)
+ _dumparrd = ""
+ }
+ return
}
-
- function _patharr0(D, q, i, h, A, B)
- {
- delete D
- if (0 < (q = split(gensub(/\\/, "/", "G", gensub(/ *([:$\\\/]) */, "\\1", "G", gensub(/(^[ \t]+)|([ \t]+$)/, "", "G", q))), A, /\/+/, B))) {
- if (2 > (h = length(B[1]))) {
- D["type"] = "FILE"
- A[1] = _patharr0_i0(A[1], D, "drive")
- return _patharr0_i1(D, A, 1, q)
- }
- i = gensub(/ *([\.\?]) */, "\\1", "G", A[2])
- IGNORECASE = 1
- match(A[1], /^((https?)|(ftp)):$/)
- IGNORECASE = 0
- if (RLENGTH > 0) {
- D["type"] = toupper(substr(A[1], 1, RLENGTH - 1))
- _patharr0_i0(i, D, "site", "port")
- } else {
- if (A[1] == "") {
- D["type"] = "UNC"
- if (h > 2) {
- D["host"]
- A[2] = _patharr0_i0(A[2], D, "drive", "", "FILE")
- return _patharr0_i1(D, A, 2, q)
- }
- if (i == "") {
- return 1
+ if (ls >= 0) {
+ for (i in A) {
+ if (! _printarrexp || i ~ _printarrexp) {
+ if (! isarray(A[i])) {
+ if (length(_dumparrd = _dumparrd ((f ? t2 : t _nop(f = 1))) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) {
+ _conl(_dumparrd)
+ _dumparrd = ""
}
- D["host"] = i
- A[3] = _patharr0_i0(A[3], D, "drive", "", "FILE")
- } else {
- D["type"] = "FILE"
- A[1] = _patharr0_i0(A[1], D, "drive")
- return _patharr0_i1(D, A, 1, q)
}
}
- return _patharr0_i1(D, A, 3, q)
}
}
-
- function _patharr0_i0(t, D, l, r, d, i)
- {
- if (i = index(t, ":")) {
- if (d) {
- D["type"] = d
- }
- if (i > 1) {
- D[l] = substr(t, 1, i - 1)
- }
- if ((t = substr(t, i + 1)) && r) {
- D[r] = t
- }
- return t
- } else {
- if (t && r) {
- D[l] = t
+ for (i in A) {
+ if (isarray(A[i])) {
+ if (! _printarrexp || i ~ _printarrexp) {
+ _printarr_i1(A[i], lv, ls, ln + ls, _th0((f ? t2 : t), f = 1) "[" i "]")
}
}
- return t
}
-
- function _patharr0_i1(D, A, i, q, t, c)
- {
- if (D["type"] == "UNC") {
- if (t = A[i++]) {
- D[0] = (D["share"] = D[++c] = t) "/"
- } else {
- return 1
- }
+ if (! f) {
+ if (length(_dumparrd = _dumparrd t _CHR["EOL"]) > 262144) {
+ _conl(_dumparrd)
+ _dumparrd = ""
}
- while (i < q) {
- D[0] = D[0] (D[++c] = A[i++]) "/"
- }
- if (i == q) {
- if (match(t = A[i], /\.[^\.]*$/)) {
- if (RSTART > 1) {
- D["name"] = substr(t, 1, RSTART - 1)
- }
- D["ext"] = substr(t, RSTART, RLENGTH)
+ }
+}
+
+function _qparam(qm, p0, p1, p2, p3, p4, p5, p6, p7)
+{
+ if (qm == qm + 0 && qm > 0) {
+ _qparamim = substr(" ", 1, qm)
+ } else {
+ if (qm != "") {
+ _qparamim = qm
+ } else {
+ _qparamim = " "
+ }
+ }
+ _qparamask = ""
+ return _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7)
+}
+
+function _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7)
+{
+ _qparama0 = substr(_qparamim, 1, 1)
+ _qparamim = substr(_qparamim, 2)
+ switch (_qparama0) {
+ case "":
+ gsub(/ +$/, "", _qparamask)
+ return length(_qparamask)
+ default:
+ if (isarray(p0)) {
+ _qparama0 = "A"
+ } else {
+ if (p0 == "" && p0 == 0) {
+ _qparama0 = " "
} else {
- if (t != "") {
- D["name"] = t
+ if (_isptr(p0)) {
+ _qparama0 = "P"
+ } else {
+ _qparama0 = "S"
}
}
}
- return 1
+ case ".":
+ _qparamask = _qparamask _qparama0
+ return _qparam_i0(p1, p2, p3, p4, p5, p6, p7)
+ }
+}
+
+#_______________________________________________________________________
+function _qstr(t, c, A, B)
+{
+ ################################################
+ c = ""
+ for (t = split(t, A, /[\x00-\x1F\\"]/, B); t >= 0; t--) {
+ c = _QSTR[B[t]] A[t + 1] c
+ }
+ return c
+}
+
+#_________________________________________________________________
+function _qstrq(t)
+{
+ ################################################
+ gsub(/\\/, "\\\\", t)
+ gsub(/"/, "\\\"", t)
+ return t
+}
+
+################################################################
+#_____________________________________________________________________________
+function _rEG(c, t, P, a, A)
+{
+ #####################################################
+ switch (c) {
+ case "_lib_CMDLN":
+ #___________________________________________________________
+ return t
+ #_____________________________________________________
+ case "_lib_APPLY":
+ return
+ #_____________________________________________________
+ case "_lib_HELP":
+ return
+ #_____________________________________________________
+ case "_lib_NAMEVER":
+ return _ln("_reg 0.001")
+ #_____________________________________________________
+ case "_lib_BEGIN":
+ return
+ #_____________________________________________________
+ case "_lib_END":
+ return
}
+}
- function _pmap(m, s1, s2, s3, s4, s5, s6, s7, s8)
- {
- if (match(m, /^([^\(]+)\(([^\)]*)\)$/, _QMAP)) {
- _qparamf1 = _QMAP[1]
- _QMAP[0] = "r" (_qparamc1 = split(_QMAP[2], _QMAP, ""))
- _qparamf0 = "_p" _QMAP[_qparamc1--]
- return @_qparamf0(s1, s2, s3, s4, s5, s6, s7, s8)
+#_______________________________________________________________________
+function _rFBRO(p)
+{
+ ######################################################
+ if (p) {
+ if (p in _tPARENT) {
+ return _tFCHLD[_tPARENT[p]]
}
+ while (p in _tPREV) {
+ p = _tPREV[p]
+ }
+ return p
}
-
- function _pr0(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1()
- }
-
- function _pr1(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1)
- }
-
- function _pr2(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2)
+ return p
+}
+
+#_______________________________________________________________________
+function _rFCHLD(p)
+{
+ #####################################################
+ if (p && p in _tFCHLD) {
+ return _tFCHLD[p]
+ }
+ return ""
+}
+
+######################## p="", !v
+#_______________________________________________________________________
+function _rLBRO(p)
+{
+ ######################################################
+ if (p) {
+ if (p in _tPARENT) {
+ return _tLCHLD[_tPARENT[p]]
+ }
+ while (p in _tNEXT) {
+ p = _tNEXT[p]
+ }
+ return p
}
-
- function _pr3(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2, p3)
+ return p
+}
+
+######################## p=""
+#_______________________________________________________________________
+function _rLCHLD(p)
+{
+ #####################################################
+ if (p && p in _tLCHLD) {
+ return _tLCHLD[p]
+ }
+ return ""
+}
+
+#_______________________________________________________________________
+function _rLINK(p)
+{
+ ######################################################
+ return ((p in _tLINK ? _tLINK[p] : ""))
+}
+
+######################## p=""
+#_______________________________________________________________________
+function _rNEXT(p)
+{
+ ######################################################
+ if (p && p in _tNEXT) {
+ return _tNEXT[p]
+ }
+ return ""
+}
+
+######################## p=""
+#_______________________________________________________________________
+function _rPARENT(p)
+{
+ ####################################################
+ if (p && p in _tPARENT) {
+ return _tPARENT[p]
+ }
+ return ""
+}
+
+######################## p=""
+#_______________________________________________________________________
+function _rPREV(p)
+{
+ ######################################################
+ if (p && p in _tPREV) {
+ return _tPREV[p]
+ }
+ return ""
+}
+
+######################## p=""
+#_______________________________________________________________________
+function _rQBRO(p, c, p1)
+{
+ ################################################
+ if (p) {
+ if (p in _tPARENT) {
+ return _tQCHLD[_tPARENT[p]]
+ }
+ c = 1
+ p1 = p
+ while (p1 in _tPREV) {
+ c++
+ p1 = _tPREV[p1]
+ }
+ while (p in _tNEXT) {
+ c++
+ p = _tNEXT[p]
+ }
+ return c
}
-
- function _pr4(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2, p3, p4)
+ return p
+}
+
+######################## p=""
+#_______________________________________________________________________
+function _rQCHLD(p)
+{
+ #####################################################
+ if (p && p in _tQCHLD) {
+ return _tQCHLD[p]
+ }
+ return ""
+}
+
+#___________________________________________________________________________________
+# EMMULATED FUNCTIONAL FIELDS ######################################################
+
+#_____________________________________________________________________________
+function _rSQFIRST(g, p, A)
+{
+ #####################################################
+ if (isarray(A)) {
+ return _rSQFIRSTA(g, p, A)
+ }
+ _SQTOPTR[g] = p
+ _SQSTACK[g][0] = 0
+ return _rsqgetptr(g, p)
+}
+
+#_________________________________________________________________
+function _rSQFIRSTA(g, p, A)
+{
+ ########################################
+ _SQTOPTR[g] = p
+ _SQSTACK[g][0] = 0
+ if ((p = _rsqgetptr(g, p)) in A) {
+ return p
}
+ return _rSQNEXTA(g, p, A)
+}
- function _pr5(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2, p3, p4, p5)
+#_______________________________________________________________________
+function _rSQNEXT(g, p, A)
+{
+ ################################################
+ if (isarray(A)) {
+ return _rSQNEXTA(g, p, A)
}
+ return _rsqnext_i0(g, p)
+}
- function _pr6(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2, p3, p4, p5, p6)
+#_________________________________________________________________
+function _rSQNEXTA(g, p, A)
+{
+ #########################################
+ if (p == _SQTOPTR[g]) {
+ if (_SQSTACK[g][0] > 0) {
+ _SQTOPTR[g] = _SQSTACK[g][_SQSTACK[g][0]--]
+ return _rSQNEXTA(g, _SQSTACK[g][_SQSTACK[g][0]--], A)
+ }
+ return
}
-
- function _pr7(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2, p3, p4, p5, p6, p7)
+ while (p in _tNEXT) {
+ if ((p = _rsqgetptr(g, _tNEXT[p])) in A) {
+ return p
+ }
}
+ return ((p in _tPARENT ? _rSQNEXTA(g, _tPARENT[p], A) : ""))
+}
- function _pr8(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
- {
- return @_qparamf1(p1, p2, p3, p4, p5, p6, p7, p8)
- }
+function _rconl(t)
+{
+ _rprt = _rprt _ln(t)
+}
- function _printarr(A, t, lv, r, a)
- {
- a = PROCINFO["sorted_in"]
- PROCINFO["sorted_in"] = "_lengthsort"
- _printarrexp = (r ? r : "")
- if (isarray(A)) {
- delete _DUMPARR
- _dumparrc = _dumparrd = ""
- _printarr_i1(A, lv = ((lv == "" ? 16 : (lv == 0 || lv + 0 != 0 ? lv : (lv == "-*" ? -3 : (lv ~ /^\+?\*$/ ? 3 : 16))))) + 0, (lv < 0 ? -1 : 1), 0, _tabtospc(t))
- PROCINFO["sorted_in"] = a
- return _retarrd(_DUMPARR, _dumparrd, _dumparrd = "")
- }
- }
+function _rconline(t)
+{
+ _rprt = _rprt _ln((t = " " t " ") _getchrln("_", _CON_WIDTH - length(t) - 1))
+}
- function _printarr_i1(A, lv, ls, ln, t, t2, i, a, f)
- {
- t2 = _getchrln(" ", length(t))
- if (ln == lv) {
- if (ls > 0) {
- for (i in A) {
- ++a
- }
- } else {
- for (i in A) {
- (isarray(A[i]) ? ++a : "")
- }
- }
- if (length(_dumparrd = _dumparrd t ((a > 0 ? " ... (x" a ")" : "")) _CHR["EOL"]) > 262144) {
- _conl(_dumparrd)
- _dumparrd = ""
- }
- return
- }
- if (ls >= 0) {
- for (i in A) {
- if (! _printarrexp || i ~ _printarrexp) {
- if (! isarray(A[i])) {
- if (length(_dumparrd = _dumparrd ((f ? t2 : t _nop(f = 1))) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) {
- _conl(_dumparrd)
- _dumparrd = ""
- }
- }
- }
- }
- }
- for (i in A) {
- if (isarray(A[i])) {
- if (! _printarrexp || i ~ _printarrexp) {
- _printarr_i1(A[i], lv, ls, ln + ls, _th0((f ? t2 : t), f = 1) "[" i "]")
+#___________________________________________________________
+function _rd_shortcut(D, f)
+{
+ if ((_shrtcutf0 = _filepath(f)) && _shortcut_nerr(_shrtcuta0 = _cmd(_shortcut_fpath " /A:Q /F:\"" _shrtcutf0 "\" 2>&1"), _shrtcutf0)) {
+ ERRNO = ""
+ split(_shrtcuta0, _SHRTCUTA0, /\x0D?\x0A/)
+ for (_shrtcuta0 in _SHRTCUTA0) {
+ for (f in _SHORTCUTRSTRUC) {
+ if (match(_SHRTCUTA0[_shrtcuta0], "^" f)) {
+ D[_SHORTCUTRSTRUC[f]] = substr(_SHRTCUTA0[_shrtcuta0], 1 + RLENGTH)
}
}
}
- if (! f) {
- if (length(_dumparrd = _dumparrd t _CHR["EOL"]) > 262144) {
- _conl(_dumparrd)
- _dumparrd = ""
- }
- }
}
+ return ((ERRNO ? ERRNO = "read shortcut: " ERRNO : _NOP))
+}
- function _qparam(qm, p0, p1, p2, p3, p4, p5, p6, p7)
- {
- if (qm == qm + 0 && qm > 0) {
- _qparamim = substr(" ", 1, qm)
- } else {
- if (qm != "") {
- _qparamim = qm
+#_______________________________________________________________________
+function _rdfile(f, i, A)
+{
+ ################################################
+ if ((f = _filerdne(f)) == "" || _filene(f) == "") {
+ ERRNO = "Filename error"
+ return
+ }
+ _fio_cmda = RS
+ RS = ".{1,}"
+ _fio_cmdb = BINMODE
+ BINMODE = "rw"
+ ERRNO = RT = _NUL
+ getline RS < f
+ BINMODE = _fio_cmdb
+ RS = _fio_cmda
+ if (ERRNO == "") {
+ close(f)
+ }
+ if (ERRNO == "") {
+ return RT
+ }
+ return (RT = _NOP)
+}
+
+####################################################################################
+# PUBLIC:
+#_____________________________________________________________________________
+# fn _th0,_th1,_th2,_th3
+# USAGE:
+# _th0(p1,p2,p3,p4)
+#
+# Each of this functions can have up to 4 parameters.
+# _th0(p1,p2,p3,p4) return 1st parameter (p1)
+# _th1(p1,p2,p3,p4) return 2nd parameter (p2)
+# _th2(p1,p2,p3,p4) return 3rd parameter (p3)
+# _th3(p1,p2,p3,p4) return 4th parameter (p4)
+#_____________________________________________________________________________
+# fn _nop(p1,p2,p3,p4,p5,p6,p7,p8)
+# USAGE:
+# _nop()
+#
+# Does not do any action. No result returned. Up to 8 parameters.
+#_____________________________________________________________________________
+# fn _exit(c)
+# USAGE:
+# _exit(code)
+#
+# This function do the same as GAWK-operator `exit code'.
+#_____________________________________________________________________________
+# fn _getdate()
+# fn _getime()
+# fn _getsecond()
+# fn _getsecondsync()
+function _rdreg(D, p)
+{
+ ################################################################
+ _rdregp0 = "reg query \"" p "\" /S /reg:64 2>NUL"
+ _rdregfld = _rdregkey = 0
+ _rdregq0 = split(gensub(/[\x0D?\x0A]{2,}/, _CHR["EOL"], "G", _cmd(_rdregp0)), _RDREGA0, /\x0D?\x0A/)
+ while (_rdregq0 > 0) {
+ _rdreg_i0(D)
+ }
+ return (_rdregfld + _rdregkey)
+}
+
+#___________________________________________________________
+function _rdreg_i0(D, A)
+{
+ while (_rdregq0 > 0) {
+ if (match(_rdregp0 = _RDREGA0[_rdregq0--], / (.*) REG_((SZ)|(DWORD)|(QWORD)|(BINARY)|(EXPAND_SZ)|(MULTI_SZ)) (.*)$/, A)) {
+ if (! _rdreg_i0(D)) {
+ ++_rdregfld
+ D[_rdregp0 A[1] "." _RDREGTYPE[A[2]]] = A[9]
+ return
} else {
- _qparamim = " "
+ break
}
- }
- _qparamask = ""
- return _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7)
- }
-
- function _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7)
- {
- _qparama0 = substr(_qparamim, 1, 1)
- _qparamim = substr(_qparamim, 2)
- switch (_qparama0) {
- case "":
- gsub(/ +$/, "", _qparamask)
- return length(_qparamask)
- default:
- if (isarray(p0)) {
- _qparama0 = "A"
- } else {
- if (p0 == "" && p0 == 0) {
- _qparama0 = " "
- } else {
- if (_isptr(p0)) {
- _qparama0 = "P"
- } else {
- _qparama0 = "S"
- }
- }
+ } else {
+ if (_rdregp0 ~ /^HK/) {
+ ++_rdregkey
+ return D[_rdregp0 = _rdregp0 "\\"]
}
- case ".":
- _qparamask = _qparamask _qparama0
- return _qparam_i0(p1, p2, p3, p4, p5, p6, p7)
}
}
+ return 1
+}
- function _qstr(t, c, A, B)
- {
- c = ""
- for (t = split(t, A, /[\x00-\x1F\\"]/, B); t >= 0; t--) {
- c = _QSTR[B[t]] A[t + 1] c
- }
- return c
- }
+#_____________________________________________________________________________________________________
+######################################################################################################
- function _qstrq(t)
- {
- gsub(/\\/, "\\\\", t)
- gsub(/"/, "\\\"", t)
- return t
- }
- function _rEG(c, t, P, a, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_reg 0.001")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
- }
- function _rFBRO(p)
- {
- if (p) {
- if (p in _tPARENT) {
- return _tFCHLD[_tPARENT[p]]
- }
- while (p in _tPREV) {
- p = _tPREV[p]
- }
- return p
- }
- return p
- }
- function _rFCHLD(p)
- {
- if (p && p in _tFCHLD) {
- return _tFCHLD[p]
- }
- return ""
- }
- function _rLBRO(p)
- {
- if (p) {
- if (p in _tPARENT) {
- return _tLCHLD[_tPARENT[p]]
- }
- while (p in _tNEXT) {
- p = _tNEXT[p]
- }
- return p
- }
- return p
- }
- function _rLCHLD(p)
- {
- if (p && p in _tLCHLD) {
- return _tLCHLD[p]
- }
- return ""
- }
- function _rLINK(p)
- {
- return ((p in _tLINK ? _tLINK[p] : ""))
- }
- function _rNEXT(p)
- {
- if (p && p in _tNEXT) {
- return _tNEXT[p]
- }
- return ""
- }
- function _rPARENT(p)
- {
- if (p && p in _tPARENT) {
- return _tPARENT[p]
- }
- return ""
- }
- function _rPREV(p)
- {
- if (p && p in _tPREV) {
- return _tPREV[p]
- }
- return ""
- }
- function _rQBRO(p, c, p1)
- {
- if (p) {
- if (p in _tPARENT) {
- return _tQCHLD[_tPARENT[p]]
- }
- c = 1
- p1 = p
- while (p1 in _tPREV) {
- c++
- p1 = _tPREV[p1]
- }
- while (p in _tNEXT) {
- c++
- p = _tNEXT[p]
- }
- return c
- }
- return p
- }
- function _rQCHLD(p)
- {
- if (p && p in _tQCHLD) {
- return _tQCHLD[p]
- }
- return ""
- }
- function _rSQFIRST(g, p, A)
- {
- if (isarray(A)) {
- return _rSQFIRSTA(g, p, A)
- }
- _SQTOPTR[g] = p
- _SQSTACK[g][0] = 0
- return _rsqgetptr(g, p)
- }
- function _rSQFIRSTA(g, p, A)
- {
- _SQTOPTR[g] = p
- _SQSTACK[g][0] = 0
- if ((p = _rsqgetptr(g, p)) in A) {
- return p
- }
- return _rSQNEXTA(g, p, A)
- }
- function _rSQNEXT(g, p, A)
- {
- if (isarray(A)) {
- return _rSQNEXTA(g, p, A)
- }
- return _rsqnext_i0(g, p)
- }
- function _rSQNEXTA(g, p, A)
- {
- if (p == _SQTOPTR[g]) {
- if (_SQSTACK[g][0] > 0) {
- _SQTOPTR[g] = _SQSTACK[g][_SQSTACK[g][0]--]
- return _rSQNEXTA(g, _SQSTACK[g][_SQSTACK[g][0]--], A)
- }
- return
- }
- while (p in _tNEXT) {
- if ((p = _rsqgetptr(g, _tNEXT[p])) in A) {
- return p
- }
- }
- return ((p in _tPARENT ? _rSQNEXTA(g, _tPARENT[p], A) : ""))
- }
- function _rconl(t)
- {
- _rprt = _rprt _ln(t)
- }
- function _rconline(t)
- {
- _rprt = _rprt _ln((t = " " t " ") _getchrln("_", _CON_WIDTH - length(t) - 1))
- }
- function _rd_shortcut(D, f)
- {
- if ((_shrtcutf0 = _filepath(f)) && _shortcut_nerr(_shrtcuta0 = _cmd(_shortcut_fpath " /A:Q /F:\"" _shrtcutf0 "\" 2>&1"), _shrtcutf0)) {
- ERRNO = ""
- split(_shrtcuta0, _SHRTCUTA0, /\x0D?\x0A/)
- for (_shrtcuta0 in _SHRTCUTA0) {
- for (f in _SHORTCUTRSTRUC) {
- if (match(_SHRTCUTA0[_shrtcuta0], "^" f)) {
- D[_SHORTCUTRSTRUC[f]] = substr(_SHRTCUTA0[_shrtcuta0], 1 + RLENGTH)
- }
- }
- }
- }
- return ((ERRNO ? ERRNO = "read shortcut: " ERRNO : _NOP))
- }
- function _rdfile(f, i, A)
- {
- if ((f = _filerdne(f)) == "" || _filene(f) == "") {
- ERRNO = "Filename error"
- return
- }
- _fio_cmda = RS
- RS = ".{1,}"
- _fio_cmdb = BINMODE
- BINMODE = "rw"
- ERRNO = RT = _NUL
- getline RS < f
- BINMODE = _fio_cmdb
- RS = _fio_cmda
- if (ERRNO == "") {
- close(f)
- }
- if (ERRNO == "") {
- return RT
- }
- return (RT = _NOP)
- }
- function _rdreg(D, p)
- {
- _rdregp0 = "reg query \"" p "\" /S /reg:64 2>NUL"
- _rdregfld = _rdregkey = 0
- _rdregq0 = split(gensub(/[\x0D?\x0A]{2,}/, _CHR["EOL"], "G", _cmd(_rdregp0)), _RDREGA0, /\x0D?\x0A/)
- while (_rdregq0 > 0) {
- _rdreg_i0(D)
- }
- return (_rdregfld + _rdregkey)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+function _rdsafe(A, i, d)
+{
+ if (i in A) {
+ return A[i]
}
+ return d
+}
- function _rdreg_i0(D, A)
- {
- while (_rdregq0 > 0) {
- if (match(_rdregp0 = _RDREGA0[_rdregq0--], / (.*) REG_((SZ)|(DWORD)|(QWORD)|(BINARY)|(EXPAND_SZ)|(MULTI_SZ)) (.*)$/, A)) {
- if (! _rdreg_i0(D)) {
- ++_rdregfld
- D[_rdregp0 A[1] "." _RDREGTYPE[A[2]]] = A[9]
- return
+#_______________________________________________________________________
+function _reg_check(p)
+{
+ _tframe("_reg_check_i0", p, p)
+}
+
+#_______________________________________________
+function _reg_check_i0(p, pp, p1, p2)
+{
+ if (_[p]["TYPE"] == "defreg") {
+ if (_[p]["REGPATH"] in _REG) {
+ if ("VALUE" in _[p]) {
+ if (_[p]["VALUE"] == _REG[_[p]["REGPATH"]]) {
+ _creport(p, substr("OK: REGENTRY MATCH(==" _[p]["VALUE"] "): " _[p]["REGPATH"], 1, 126))
} else {
- break
+ _dllerr(p, substr("REGENTRY NOT MATCH(!=" _[p]["VALUE"] "): " _[p]["REGPATH"], 1, 126))
}
} else {
- if (_rdregp0 ~ /^HK/) {
- ++_rdregkey
- return D[_rdregp0 = _rdregp0 "\\"]
+ if (_VAR[_[p]["REGPATH"]] == _REG[_[p]["REGPATH"]]) {
+ _creport(p, substr("OK: REGPATH MATCH(==" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126))
+ } else {
+ _dllerr(p, substr("REGPATH NOT MATCH(!=" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126))
}
}
+ } else {
+ _dllerr(p, substr("REGPATH NOT FOUND: " _[p]["REGPATH"], 1, 126))
}
- return 1
- }
-
- function _rdsafe(A, i, d)
- {
- if (i in A) {
- return A[i]
- }
- return d
}
+}
- function _reg_check(p)
- {
- _tframe("_reg_check_i0", p, p)
- }
+#_____________________________________________________
+function _registryinit()
+{
+ _registrytmpfile = _getmpfile()
+}
- function _reg_check_i0(p, pp, p1, p2)
- {
- if (_[p]["TYPE"] == "defreg") {
- if (_[p]["REGPATH"] in _REG) {
- if ("VALUE" in _[p]) {
- if (_[p]["VALUE"] == _REG[_[p]["REGPATH"]]) {
- _creport(p, substr("OK: REGENTRY MATCH(==" _[p]["VALUE"] "): " _[p]["REGPATH"], 1, 126))
- } else {
- _dllerr(p, substr("REGENTRY NOT MATCH(!=" _[p]["VALUE"] "): " _[p]["REGPATH"], 1, 126))
- }
+# _rdregfld : gvar - number of readed registry fields by _rdreg()
+# _rdregkey : gvar - number of readed registry keys by _rdreg()
+#_____________________________________________________________________________
+function _regpath0(D, i, s, q, S)
+{
+ ############################################ 0 #
+ if (i = _patharr0(S, i)) {
+ if ("name" in S) {
+ D["name"] = S["name"]
+ }
+ if ("ext" in S) {
+ D["ext"] = S["ext"]
+ }
+ s = ((toupper(s = (i in S ? S[i] : "")) in _REGPATH0REGDIR ? D[++q] = _REGPATH0REGDIR[toupper(s)] : (D[++q] = _REGPATH0REGDIR[""]) "\\" (D[++q] = s))) "\\"
+ while (++i in S) {
+ s = s (D[++q] = S[i]) "\\"
+ }
+ if (s != "") {
+ D[0] = s
+ }
+ IGNORECASE = 1
+ D["hostdir"] = "\\\\" (D["host"] = ("host" in S && ("" == (i = S["host"]) || "." == i || "?" == i || "localhost" == i) ? ENVIRON["COMPUTERNAME"] : i)) "\\" s
+ IGNORECASE = 0
+ }
+}
+
+#_________________________________________________________________________________________
+function _report(p)
+{
+ #######################################################################
+ _report_t0 = _reportparnt = ""
+ _report_i0(p)
+ _tframe("_report_i0", p)
+ return _report_t0
+}
+
+function _report_i0(p, p0, p1, p2)
+{
+ if (p in _tPARENT) {
+ if (_reportparnt != (_reportparnt = _tPARENT[p])) {
+ _report_t0 = _report_t0 _ln() _ln((z = "_ " _[_tPARENT[p]]["NAME"] " ") _getchrln("_", _CON_WIDTH - length(z) - 2)) _ln(_getchrln("#", _CON_WIDTH - 2)) _ln()
+ }
+ }
+ if ("ERROR" in _[p]) {
+ _report_t0 = _report_t0 _reporterr(p, _[p]["ERROR"])
+ }
+ if ("REPORT" in _[p]) {
+ _report_t0 = _report_t0 _ln(_[p]["REPORT"])
+ }
+}
+
+#___________________________________________________________________________________
+function _reporterr(p, t3, pp, t, t2)
+{
+ t = ""
+ pp = p
+ do {
+ ("NAME" in _[pp] ? t = _[pp]["NAME"] ": " t : "")
+ } while (pp = _rPARENT(pp))
+ if (match(t3, /\x00/)) {
+ return (substr(t3, 1, RSTART - 1) t substr(t3, RSTART + 1))
+ }
+ return (t t3)
+}
+
+#___________________________________________________________________________________
+####################################################################################
+
+
+
+
+#_______________________________________________________________________
+# _CHR array
+#
+# _CHR[ASC-code decimal number]=="char"
+#
+# Contains 256 elements. The index is the decimal number from 0-255.
+# The value is the single character with ASC-code equivalent to index number:
+#
+# _CHR[97] =="a" - character with ASC-code 97 is `a'
+#
+# This array is useful if you want to get character using it's ASC-code
+#_________________________________________________________________
+# _ASC array
+#
+# _ASC[char]==number: ASC-code of char
+#
+# Contains 256 elements. The index is the any single character with ASC-code \x00-\xFF.
+# The value is the number equivalent of character's ASC-code:
+#
+# _ASC["A"] ==65 - ASC-code of character `A' is 65
+#
+# This array is useful if you want to get ASC-code of the character.
+#_________________________________________________________________
+# _QASC array
+#
+# _QASC[char]=="string: octal ASC-code of char in 3-digit octal format"
+#
+# Contains 256 elements. The index is the any single charcter with ASC-code \x00-\xFF.
+# The value is the octal number equivalent of character's ASC-code in fixed-length - 3-digit - string:
+#
+# _QASC["!"] =="041" - ASC-code of character `!' is 33(decimal) == 41(in octal)
+# _QASC["\x0D"] =="015"
+#
+# This array is useful when some type of string escape conversion is performed. It allows quickly get
+# replace string for the characters that can be specified only by character code in result string:
+#
+# "\x0D" -> "\\015"
+#_______________________________________________________________________
+
+
+
+
+
+
+
+####################################################################################
+# PUBLIC:
+#_____________________________________________________________________________
+# fn _getchrln(ptt,len)
+#_____________________________________________________________________________
+# fn _tabtospc(src,tabstep,xcoord)
+####################################################################################
+
+#_____________________________________________________________________________
+function _retarr(A, i, p, a, q)
+{
+ ##################################################
+ if (isarray(A)) {
+ i = (i == "" ? 0 : i + 0)
+ q = A[_ARRLEN] + 0
+ if (i < q) {
+ return (p A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] _retarr_i0(A, q, i, a))
+ }
+ }
+}
+
+function _retarr_i0(A, q, i, a)
+{
+ if (i < q) {
+ return (A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] _retarr_i0(A, q, i, a))
+ }
+ while (q < i) {
+ delete A[++q]
+ }
+ return a
+}
+
+#_________________________________________________________________
+function _retarrd(A, v, i)
+{
+ #########################################
+ if (1 in A) {
+ return (A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] A[10] A[11] A[12] A[13] A[14] A[15] A[16] (((i = 17) in A ? _retarrd_i0(A, i) v : v)))
+ }
+ delete A
+ return v
+}
+
+#_____________________________________________________
+function _retarrd_i0(A, i)
+{
+ if (i in A) {
+ return (A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] ((i in A ? _retarrd_i0(A, i) : "")))
+ }
+ delete A
+}
+
+#_______________________________________________________________________
+########################################################################
+#EXPERIMENTAL
+
+function _rexpfn(R, t, p)
+{
+ _REXPFN[""] = ""
+ while (t) {
+ t = _rxpfn(R, t, p)
+ }
+ return _REXPFN[""]
+}
+
+function _rexpfnend(t)
+{
+ _REXPFN[""] = t
+}
+
+#_____________________________________________________________________________
+function _rexpstr(r, i, c, A)
+{
+ ###################################################
+ c = split(r, A, "")
+ r = ""
+ for (i = 1; i <= c; i++) {
+ r = r _REXPSTR[A[i]]
+ }
+ return r
+}
+
+#_____________________________________________________________________________
+function _rexpstr_i0(t, A, p0)
+{
+ return (_REXPSTR[t] = "\\" t)
+}
+
+#___________________________________________________________
+function _rmtsharerr(h, t)
+{
+ gsub(/[\x0D\x0A]+/, "", t)
+ if (t ~ /^The command failed: 53/) {
+ ERRNO = "host not found: \\\\" h
+ } else {
+ ERRNO = t ": \\\\" h
+ }
+}
+
+function _rpp(q, D, S)
+{
+ _conl()
+ _conline(q)
+ _conl()
+ _regpath0(D, q)
+ #_conl(_dumparr(D))
+
+ _conl(_ln("DEST:") _dumparr(D))
+ _conl()
+ return q
+}
+
+#_________________________________________________________________________________________
+function _rrdreg(DD, p, k, t, v, c, i, q, tT, A, B, C, D)
+{
+ ############################################# old; regedit
+ if (! _registrytmpfile) {
+ _registryinit()
+ }
+ _cmd("regedit /E \"" _registrytmpfile "\" \"" p "\" 2>&1")
+ q = patsplit(gensub(/[\x00\xFF\xFE]+/, "", "G", _rdfile(_registrytmpfile)), A, /\x0D?\x0A\[[^\]]+\]\x0D?\x0A/, B)
+ for (i = 1; i <= q; i++) {
+ p = gensub(/(^[ \t\x0D\x0A]*\[)|((\\)\\+)|(\][ \t\x0D\x0A]*$)/, "\\3", "G", A[i])
+ DD[p "\\"]
+ delete C[split(B[i], C, /[\x0D\x0A]+/)]
+ for (c = 1; c in C; c++) {
+ tt = tt C[c]
+ if (gsub(/\\$/, "", tt)) {
+ continue
+ }
+ if (tt == "") {
+ continue
+ }
+ if (match(_th0(tt, tt = ""), /((^"(([^\\"]|\\.)*)")|(@))=(("(([^\\"]|\\.)*)")|(dword:([[:xdigit:]]{8}))|(hex(\(([27b])\))?:(.*)))$/, D)) {
+ if (D[7]) {
+ t = "STR"
+ v = _unstr(D[8])
} else {
- if (_VAR[_[p]["REGPATH"]] == _REG[_[p]["REGPATH"]]) {
- _creport(p, substr("OK: REGPATH MATCH(==" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126))
+ if (D[10]) {
+ t = "W32"
+ v = D[11]
} else {
- _dllerr(p, substr("REGPATH NOT MATCH(!=" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126))
+ v = D[15]
+ if (D[13]) {
+ switch (D[14]) {
+ case "2":
+ t = "XSZ"
+ break
+ case "7":
+ t = "MSZ"
+ break
+ default:
+ t = "W64"
+ }
+ } else {
+ t = "BIN"
+ }
}
}
+ DD[gensub(/(\\)\\+/, "\\1", "G", p "\\" _unstr(D[3] ((D[5] ? "(Default)" : ""))) "." t)] = v
} else {
- _dllerr(p, substr("REGPATH NOT FOUND: " _[p]["REGPATH"], 1, 126))
+ _fatal("regedit: unknown output format(" c "): `" C[c] "'")
}
}
}
+}
- function _registryinit()
- {
- _registrytmpfile = _getmpfile()
- }
-
- function _regpath0(D, i, s, q, S)
- {
- if (i = _patharr0(S, i)) {
- if ("name" in S) {
- D["name"] = S["name"]
- }
- if ("ext" in S) {
- D["ext"] = S["ext"]
- }
- s = ((toupper(s = (i in S ? S[i] : "")) in _REGPATH0REGDIR ? D[++q] = _REGPATH0REGDIR[toupper(s)] : (D[++q] = _REGPATH0REGDIR[""]) "\\" (D[++q] = s))) "\\"
- while (++i in S) {
- s = s (D[++q] = S[i]) "\\"
- }
- if (s != "") {
- D[0] = s
- }
- IGNORECASE = 1
- D["hostdir"] = "\\\\" (D["host"] = ("host" in S && ("" == (i = S["host"]) || "." == i || "?" == i || "localhost" == i) ? ENVIRON["COMPUTERNAME"] : i)) "\\" s
- IGNORECASE = 0
+#_________________________________________________________________
+function _rsqgetptr(g, p, A)
+{
+ if (p in _tLINK) {
+ _SQSTACK[g][++_SQSTACK[g][0]] = p
+ _SQSTACK[g][++_SQSTACK[g][0]] = _SQTOPTR[g]
+ while ((p = _tLINK[p]) in _tLINK) {
+ _con(".")
}
+ _SQTOPTR[g] = p
}
-
- function _report(p)
- {
- _report_t0 = _reportparnt = ""
- _report_i0(p)
- _tframe("_report_i0", p)
- return _report_t0
- }
-
- function _report_i0(p, p0, p1, p2)
- {
- if (p in _tPARENT) {
- if (_reportparnt != (_reportparnt = _tPARENT[p])) {
- _report_t0 = _report_t0 _ln() _ln((z = "_ " _[_tPARENT[p]]["NAME"] " ") _getchrln("_", _CON_WIDTH - length(z) - 2)) _ln(_getchrln("#", _CON_WIDTH - 2)) _ln()
- }
- }
- if ("ERROR" in _[p]) {
- _report_t0 = _report_t0 _reporterr(p, _[p]["ERROR"])
- }
- if ("REPORT" in _[p]) {
- _report_t0 = _report_t0 _ln(_[p]["REPORT"])
- }
+ if (p in _tFCHLD) {
+ return _rsqgetptr(g, _tFCHLD[p])
}
+ return p
+}
- function _reporterr(p, t3, pp, t, t2)
- {
- t = ""
- pp = p
- do {
- ("NAME" in _[pp] ? t = _[pp]["NAME"] ": " t : "")
- } while (pp = _rPARENT(pp))
- if (match(t3, /\x00/)) {
- return (substr(t3, 1, RSTART - 1) t substr(t3, RSTART + 1))
+#___________________________________________________________
+function _rsqnext_i0(g, p)
+{
+ if (p == _SQTOPTR[g]) {
+ if (_SQSTACK[g][0] > 0) {
+ _SQTOPTR[g] = _SQSTACK[g][_SQSTACK[g][0]--]
+ return _rsqnext_i0(g, _SQSTACK[g][_SQSTACK[g][0]--])
}
- return (t t3)
+ return
}
-
- function _retarr(A, i, p, a, q)
- {
- if (isarray(A)) {
- i = (i == "" ? 0 : i + 0)
- q = A[_ARRLEN] + 0
- if (i < q) {
- return (p A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] _retarr_i0(A, q, i, a))
+ if (p in _tNEXT) {
+ return _rsqgetptr(g, _tNEXT[p])
+ }
+ return _rsqnext_i0(g, _tPARENT[p])
+}
+
+function _rtn(v, A)
+{
+ _conl()
+ _conline(_val(v) " : " _val(A))
+ _conl()
+ _rtn2(v, A)
+ _conl()
+}
+
+function _rtn2(v, A, r, t)
+{
+ r = (isarray(A) ? _typa(v, A) : _typ(v))
+ if ("`" > _t0 && _t0) {
+ _conl("ggggg")
+ }
+ t = ((r ? "TRUE" : "FALSE")) " / " ((r > 0 ? r ">0" : r "!>0")) " / " ((r + 0 > 0 ? r "+0>0" : r "+0!>0")) " / " ((r + 0 != r ? r "+0!=" r : r "+0==" r)) " / " ((r && "`" > r ? "'`'>" r " && " r : "!('`'>" r " && " r ")"))
+ _conl("`" r "' : " t)
+ return r
+}
+
+function _rxpfn(R, t, p, i, f, A)
+{
+ for (i in R) {
+ if (match(t, i, A)) {
+ f = R[i]
+ if (t != (t = @f(A, substr(t, RLENGTH + 1), p))) {
+ return t
}
}
}
+ return _rexpfnend(t)
+}
- function _retarr_i0(A, q, i, a)
- {
- if (i < q) {
- return (A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] _retarr_i0(A, q, i, a))
- }
- while (q < i) {
- delete A[++q]
- }
- return a
+##############################################################
+#_____________________________________________________________________________
+function _sHARE(c, t, P, a, A)
+{
+ ###################################################
+ switch (c) {
+ case "_lib_CMDLN":
+ #___________________________________________________________
+ return t
+ #_____________________________________________________
+ case "_lib_APPLY":
+ return
+ #_____________________________________________________
+ case "_lib_HELP":
+ return
+ #_____________________________________________________
+ case "_lib_NAMEVER":
+ return _ln("_share 1.000")
+ #_____________________________________________________
+ case "_lib_BEGIN":
+ return
+ #_____________________________________________________
+ case "_lib_END":
+ return
}
+}
- function _retarrd(A, v, i)
- {
- if (1 in A) {
- return (A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] A[10] A[11] A[12] A[13] A[14] A[15] A[16] (((i = 17) in A ? _retarrd_i0(A, i) v : v)))
- }
- delete A
- return v
+################################################################
+#_____________________________________________________________________________
+function _sYS(c, t, P, a, A)
+{
+ #####################################################
+ switch (c) {
+ case "_lib_CMDLN":
+ #___________________________________________________________
+ return t
+ #_____________________________________________________
+ case "_lib_APPLY":
+ return
+ #_____________________________________________________
+ case "_lib_HELP":
+ return
+ #_____________________________________________________
+ case "_lib_NAMEVER":
+ return
+ #_____________________________________________________
+ case "_lib_BEGIN":
+ return
+ #_____________________________________________________
+ case "_lib_END":
+ return
}
+}
- function _retarrd_i0(A, i)
- {
- if (i in A) {
- return (A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] ((i in A ? _retarrd_i0(A, i) : "")))
- }
- delete A
- }
+#_______________________________________________________________________
+function _serv_check(p)
+{
+ _tframe("_serv_check_i0", p, p)
+}
- function _rexpfn(R, t, p)
- {
- _REXPFN[""] = ""
- while (t) {
- t = _rxpfn(R, t, p)
+#_______________________________________________
+function _serv_check_i0(p, p0, p1, p2, p3, i, q, c)
+{
+ if (_[p]["TYPE"] == "defsrv") {
+ i = IGNORECASE
+ IGNORECASE = 1
+ if (match(_servoutput, roi = "\\012DISPLAY_NAME: " _torexp(_[p]["SERVNAME"]))) {
+ _creport(p, "OK: SERVICE DETECTED: " substr(_[p]["SERVNAME"], 1, 112))
+ } else {
+ _dllerr(p, "service " _[p]["SERVNAME"] " not detected")
}
- return _REXPFN[""]
}
+ IGNORECASE = i
+}
- function _rexpfnend(t)
- {
- _REXPFN[""] = t
+#_______________________________________________________________________
+function _setarrsort(f, a)
+{
+ ##############################################
+ a = PROCINFO["sorted_in"]
+ if (! f) {
+ delete PROCINFO["sorted_in"]
+ } else {
+ PROCINFO["sorted_in"] = f
}
+ return a
+}
- function _rexpstr(r, i, c, A)
- {
- c = split(r, A, "")
- r = ""
- for (i = 1; i <= c; i++) {
- r = r _REXPSTR[A[i]]
+#_______________________________________________________________________
+function _setmpath(p, a)
+{
+ ################################################
+ ERRNO = ""
+ if (p && (a = _filerd(p))) {
+ if (_FILEIO_TMPRD) {
+ _FILEIO_TMPATHS[_FILEIO_TMPRD]
}
- return r
+ #if ( _filexist(a) ) _del(a)
+ #_cmd("rd " a " /S /Q 2>NUL"); _cmd("del " a " /Q 2>NUL")
+ return (_FILEIO_TMPRD = a)
+ } else {
+ return _warning("`" p "': cannot set temporary folder" ((ERRNO ? ": " ERRNO : "")))
}
+}
- function _rexpstr_i0(t, A, p0)
- {
- return (_REXPSTR[t] = "\\" t)
- }
+#_________________________________________________________________________________________
+##########################################################################################
- function _rmtsharerr(h, t)
- {
- gsub(/[\x0D\x0A]+/, "", t)
- if (t ~ /^The command failed: 53/) {
- ERRNO = "host not found: \\\\" h
- } else {
- ERRNO = t ": \\\\" h
- }
- }
- function _rpp(q, D, S)
- {
- _conl()
- _conline(q)
- _conl()
- _regpath0(D, q)
- _conl(_ln("DEST:") _dumparr(D))
- _conl()
- return q
- }
- function _rrdreg(DD, p, k, t, v, c, i, q, tT, A, B, C, D)
- {
- if (! _registrytmpfile) {
- _registryinit()
- }
- _cmd("regedit /E \"" _registrytmpfile "\" \"" p "\" 2>&1")
- q = patsplit(gensub(/[\x00\xFF\xFE]+/, "", "G", _rdfile(_registrytmpfile)), A, /\x0D?\x0A\[[^\]]+\]\x0D?\x0A/, B)
- for (i = 1; i <= q; i++) {
- p = gensub(/(^[ \t\x0D\x0A]*\[)|((\\)\\+)|(\][ \t\x0D\x0A]*$)/, "\\3", "G", A[i])
- DD[p "\\"]
- delete C[split(B[i], C, /[\x0D\x0A]+/)]
- for (c = 1; c in C; c++) {
- tt = tt C[c]
- if (gsub(/\\$/, "", tt)) {
- continue
- }
- if (tt == "") {
- continue
- }
- if (match(_th0(tt, tt = ""), /((^"(([^\\"]|\\.)*)")|(@))=(("(([^\\"]|\\.)*)")|(dword:([[:xdigit:]]{8}))|(hex(\(([27b])\))?:(.*)))$/, D)) {
- if (D[7]) {
- t = "STR"
- v = _unstr(D[8])
- } else {
- if (D[10]) {
- t = "W32"
- v = D[11]
- } else {
- v = D[15]
- if (D[13]) {
- switch (D[14]) {
- case "2":
- t = "XSZ"
- break
- case "7":
- t = "MSZ"
- break
- default:
- t = "W64"
- }
- } else {
- t = "BIN"
- }
- }
- }
- DD[gensub(/(\\)\\+/, "\\1", "G", p "\\" _unstr(D[3] ((D[5] ? "(Default)" : ""))) "." t)] = v
- } else {
- _fatal("regedit: unknown output format(" c "): `" C[c] "'")
- }
- }
- }
- }
- function _rsqgetptr(g, p, A)
- {
- if (p in _tLINK) {
- _SQSTACK[g][++_SQSTACK[g][0]] = p
- _SQSTACK[g][++_SQSTACK[g][0]] = _SQTOPTR[g]
- while ((p = _tLINK[p]) in _tLINK) {
- _con(".")
- }
- _SQTOPTR[g] = p
- }
- if (p in _tFCHLD) {
- return _rsqgetptr(g, _tFCHLD[p])
- }
- return p
- }
- function _rsqnext_i0(g, p)
- {
- if (p == _SQTOPTR[g]) {
- if (_SQSTACK[g][0] > 0) {
- _SQTOPTR[g] = _SQSTACK[g][_SQSTACK[g][0]--]
- return _rsqnext_i0(g, _SQSTACK[g][_SQSTACK[g][0]--])
- }
- return
- }
- if (p in _tNEXT) {
- return _rsqgetptr(g, _tNEXT[p])
- }
- return _rsqnext_i0(g, _tPARENT[p])
- }
- function _rtn(v, A)
- {
- _conl()
- _conline(_val(v) " : " _val(A))
- _conl()
- _rtn2(v, A)
- _conl()
- }
- function _rtn2(v, A, r, t)
- {
- r = (isarray(A) ? _typa(v, A) : _typ(v))
- if ("`" > _t0 && _t0) {
- _conl("ggggg")
- }
- t = ((r ? "TRUE" : "FALSE")) " / " ((r > 0 ? r ">0" : r "!>0")) " / " ((r + 0 > 0 ? r "+0>0" : r "+0!>0")) " / " ((r + 0 != r ? r "+0!=" r : r "+0==" r)) " / " ((r && "`" > r ? "'`'>" r " && " r : "!('`'>" r " && " r ")"))
- _conl("`" r "' : " t)
- return r
- }
- function _rxpfn(R, t, p, i, f, A)
- {
- for (i in R) {
- if (match(t, i, A)) {
- f = R[i]
- if (t != (t = @f(A, substr(t, RLENGTH + 1), p))) {
- return t
- }
- }
- }
- return _rexpfnend(t)
- }
- function _sHARE(c, t, P, a, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_share 1.000")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
- }
- function _sYS(c, t, P, a, A)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- }
- }
- function _serv_check(p)
- {
- _tframe("_serv_check_i0", p, p)
- }
- function _serv_check_i0(p, p0, p1, p2, p3, i, q, c)
- {
- if (_[p]["TYPE"] == "defsrv") {
- i = IGNORECASE
- IGNORECASE = 1
- if (match(_servoutput, roi = "\\012DISPLAY_NAME: " _torexp(_[p]["SERVNAME"]))) {
- _creport(p, "OK: SERVICE DETECTED: " substr(_[p]["SERVNAME"], 1, 112))
- } else {
- _dllerr(p, "service " _[p]["SERVNAME"] " not detected")
- }
- }
- IGNORECASE = i
- }
- function _setarrsort(f, a)
- {
- a = PROCINFO["sorted_in"]
- if (! f) {
- delete PROCINFO["sorted_in"]
- } else {
- PROCINFO["sorted_in"] = f
- }
- return a
- }
- function _setmpath(p, a)
- {
- ERRNO = ""
- if (p && (a = _filerd(p))) {
- if (_FILEIO_TMPRD) {
- _FILEIO_TMPATHS[_FILEIO_TMPRD]
- }
- return (_FILEIO_TMPRD = a)
- } else {
- return _warning("`" p "': cannot set temporary folder" ((ERRNO ? ": " ERRNO : "")))
- }
- }
- function _sharelist(D, h, q, c, l, A, B)
- {
- delete D
- c = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) " 2>&1"
- if (match(c = _cmd(c), /\x0AShare[^\x0A]*Remark/)) {
- gsub(/(^[^-]*\x0D?\x0A-+\x0D?\x0A[ \t]*)|(\x0D?\x0AThe command completed successfully.*$)/, "", c)
- l = RLENGTH - 7
- split(c, A, /([ \t]*\x0D?\x0A)+[ \t]*/)
- for (c in A) {
- if (match(A[c], /((([^ \t:]+[ \t]+)*[^ \t:]+)[ \t]+)([A-Za-z])[ \t]*:/, B) && ++q) {
- D[B[2]] = (A[c] ~ /\.\.\.$/ ? _sharepath(h, B[2]) : gensub(/[ \t\\\/]*$/, "\\\\", 1, substr(A[c], 1 + B[1, "length"], l - B[1, "length"])))
- }
+
+
+
+
+
+function _sharelist(D, h, q, c, l, A, B)
+{
+ #################################################
+ delete D
+ c = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) " 2>&1"
+ if (match(c = _cmd(c), /\x0AShare[^\x0A]*Remark/)) {
+ gsub(/(^[^-]*\x0D?\x0A-+\x0D?\x0A[ \t]*)|(\x0D?\x0AThe command completed successfully.*$)/, "", c)
+ l = RLENGTH - 7
+ split(c, A, /([ \t]*\x0D?\x0A)+[ \t]*/)
+ for (c in A) {
+ if (match(A[c], /((([^ \t:]+[ \t]+)*[^ \t:]+)[ \t]+)([A-Za-z])[ \t]*:/, B) && ++q) {
+ D[B[2]] = (A[c] ~ /\.\.\.$/ ? _sharepath(h, B[2]) : gensub(/[ \t\\\/]*$/, "\\\\", 1, substr(A[c], 1 + B[1, "length"], l - B[1, "length"])))
}
- return q
}
- return _rmtsharerr(h, c)
+ return q
}
+ return _rmtsharerr(h, c)
+}
- function _sharepath(h, s, A)
- {
- s = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) "\\\"" s "\" 2>&1"
- if (match(s = _cmd(s), /\x0APath[ \t]+([^\x0D\x0A]+)/, _SHAREPATHA0)) {
- return gensub(/[ \t\\\/]*$/, "\\\\", 1, _SHAREPATHA0[1])
- }
- return _rmtsharerr(h, s)
+#_____________________________________________________________________________
+function _sharepath(h, s, A)
+{
+ ###################################################
+ s = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) "\\\"" s "\" 2>&1"
+ if (match(s = _cmd(s), /\x0APath[ \t]+([^\x0D\x0A]+)/, _SHAREPATHA0)) {
+ return gensub(/[ \t\\\/]*$/, "\\\\", 1, _SHAREPATHA0[1])
}
+ return _rmtsharerr(h, s)
+}
- function _shortcut(D, S)
- {
- if (isarray(D)) {
- if (isarray(S)) {
- _addarrmask(D, S, _SHORTCUTWSTRUC)
+function _shortcut(D, S)
+{
+ #############################################################
+ if (isarray(D)) {
+ if (isarray(S)) {
+ _addarrmask(D, S, _SHORTCUTWSTRUC)
+ } else {
+ if (S == 0 && S == "") {
+ # array,array2* - copy from array2 to array shorcut-specific elements
+ _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC)
} else {
- if (S == 0 && S == "") {
- _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC)
+ if (_isnotfileptr(S)) {
+ # array* - define shortcut-specific elements in array by default values
+ _addarrmask(D, _[S], _SHORTCUTWSTRUC)
} else {
- if (_isnotfileptr(S)) {
- _addarrmask(D, _[S], _SHORTCUTWSTRUC)
- } else {
- if (_rd_shortcut(D, S)) {
- return
- }
+ if (_rd_shortcut(D, S)) {
+ return
}
}
}
+ }
+ # array,ptr* - copy from array _[ptr] to array shorcut-specific elements
+ } else {
+ if (D == 0 && D == "") {
+ return _NOP
} else {
- if (D == 0 && D == "") {
- return _NOP
- } else {
- if (_isnotfileptr(D)) {
- if (isarray(S)) {
- _addarrmask(_[D], S, _SHORTCUTWSTRUC)
+ if (_isnotfileptr(D)) {
+ # -* - no action(return -)
+ if (isarray(S)) {
+ _addarrmask(_[D], S, _SHORTCUTWSTRUC)
+ } else {
+ if (S == 0 && S == "") {
+ # ptr,array* - copy from array to array _[ptr] shorcut-specific elements
+ _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC)
} else {
- if (S == 0 && S == "") {
- _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC)
+ if (_isnotfileptr(S)) {
+ # ptr* - define shortcut-specifc elements in array _[ptr] by default values
+ _addarrmask(_[D], _[S], _SHORTCUTWSTRUC)
} else {
- if (_isnotfileptr(S)) {
- _addarrmask(_[D], _[S], _SHORTCUTWSTRUC)
- } else {
- if (_rd_shortcut(_[D], S)) {
- return
- }
+ if (_rd_shortcut(_[D], S)) {
+ return
}
}
}
+ }
+ # ptr,ptr2* - copy from array _[ptr2] to array _[ptr] shorcut-specific elements
+ } else {
+ # ptr,filepath* - define in array _[ptr] shortcut-specific elements by reading its from shortcut file filepath(load shortcut)
+ if (isarray(S) && _wr_shortcut(D, S)) {
+ return
} else {
- if (isarray(S) && _wr_shortcut(D, S)) {
+ if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) {
return
} else {
- if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) {
+ if (_isnotfileptr(S) && _wr_shortcut(D, _[S])) {
return
} else {
- if (_isnotfileptr(S) && _wr_shortcut(D, _[S])) {
+ if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) {
return
- } else {
- if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) {
- return
- }
}
}
}
}
- }
- }
- return 1
- }
-
- function _shortcut_init(A, B, q)
- {
- _SHORTCUTERR[2] = "file not found"
- _SHORTCUTERR[3] = "no such filepath"
- _SHORTCUTERR["The system cannot find the file specified."] = "no such filepath"
- _SHORTCUTERR[5] = "file is folder"
- _SHORTCUTERR["Access is denied."] = "file is folder"
- _SHORTCUTERR[123] = "filepath syntax error"
- _SHORTCUTERR["The filename, directory name, or volume label syntax is incorrect."] = "filepath syntax error"
- q = "target\t\t\t/T:\t\t\t\tTargetPath=\t\t\t\t\ttarget?\t\t\t;\t\t\t_target\t\t\t\t\t\t\tTargetPathExpanded=\t\t\t\t\t\t\t;\t\t\tparameters\t\t\t/P:\t\t\t\tArguments=\t\t\t\t\tparaneters?\t\t\t;\t\t\t_parameters\t\t\t\t\t\t\tArgumentsExpanded=\t\t\t\t\t\t\t;\t\t\tstartdir\t\t\t/W:\t\t\t\tWorkingDirectory=\t\t\t\tstartdir?\t\t\t;\t\t\t_startdir\t\t\t\t\t\t\tWorkingDirectoryExpanded=\t\t\t\t\t\t;\t\t\trunstyle\t\t\t/R:\t\t\t\tRunStyle=\t\t\t\t\t1\t\t\t\t;\t\t\ticon,index\t\t\t/I:\t\t\t\tIconLocation=\t\t\t\ticon,index?\t\t\t;\t\t\txicon,index\t\t\t\t\t\t\tIconLocationExpanded=\t\t\t\t\t\t\t;\t\t\tshortcut key\t\t/H:\t\t\t\tHotKey=\t\t\t\t\t0\t\t\t\t;\t\t\tdescription\t\t\t/D:\t\t\t\tDescription=\t\t\t\t_env4: default shortcut\t"
- split(q, _SHRTCUTA0, /[ \t]*;[ \t]*/)
- for (q in _SHRTCUTA0) {
- if (match(_SHRTCUTA0[q], /^([^\t]+)\t+([^\t]+)(\t+([^\t]+)(\t+([^\t]+))?)?/, B)) {
- if (B[3] == "") {
- _SHORTCUTRSTRUC[B[2]] = B[1]
+ # filepath,ptr* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array _[ptr](save shortcut)
+ }
+ }
+ }
+ # filepath,filepath2* - [over]write shorcut file filepath; shortcut parameters will be defined from shortcut file filepath2(copy shortcut)
+ return 1
+}
+
+#________________________________________________
+function _shortcut_init(A, B, q)
+{
+ _SHORTCUTERR[2] = "file not found"
+ _SHORTCUTERR[3] = "no such filepath"
+ _SHORTCUTERR["The system cannot find the file specified."] = "no such filepath"
+ _SHORTCUTERR[5] = "file is folder"
+ _SHORTCUTERR["Access is denied."] = "file is folder"
+ _SHORTCUTERR[123] = "filepath syntax error"
+ _SHORTCUTERR["The filename, directory name, or volume label syntax is incorrect."] = "filepath syntax error"
+ q = "target\t\t\t/T:\t\t\t\tTargetPath=\t\t\t\t\ttarget?\t\t\t;\t\t\t_target\t\t\t\t\t\t\tTargetPathExpanded=\t\t\t\t\t\t\t;\t\t\tparameters\t\t\t/P:\t\t\t\tArguments=\t\t\t\t\tparaneters?\t\t\t;\t\t\t_parameters\t\t\t\t\t\t\tArgumentsExpanded=\t\t\t\t\t\t\t;\t\t\tstartdir\t\t\t/W:\t\t\t\tWorkingDirectory=\t\t\t\tstartdir?\t\t\t;\t\t\t_startdir\t\t\t\t\t\t\tWorkingDirectoryExpanded=\t\t\t\t\t\t;\t\t\trunstyle\t\t\t/R:\t\t\t\tRunStyle=\t\t\t\t\t1\t\t\t\t;\t\t\ticon,index\t\t\t/I:\t\t\t\tIconLocation=\t\t\t\ticon,index?\t\t\t;\t\t\txicon,index\t\t\t\t\t\t\tIconLocationExpanded=\t\t\t\t\t\t\t;\t\t\tshortcut key\t\t/H:\t\t\t\tHotKey=\t\t\t\t\t0\t\t\t\t;\t\t\tdescription\t\t\t/D:\t\t\t\tDescription=\t\t\t\t_env4: default shortcut\t"
+ split(q, _SHRTCUTA0, /[ \t]*;[ \t]*/)
+ for (q in _SHRTCUTA0) {
+ if (match(_SHRTCUTA0[q], /^([^\t]+)\t+([^\t]+)(\t+([^\t]+)(\t+([^\t]+))?)?/, B)) {
+ if (B[3] == "") {
+ _SHORTCUTRSTRUC[B[2]] = B[1]
+ } else {
+ if (B[5] == "") {
+ _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2]
+ delete _SHORTCUTDEFAULT[B[1]]
} else {
- if (B[5] == "") {
- _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2]
- delete _SHORTCUTDEFAULT[B[1]]
- } else {
- _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2]
- _SHORTCUTDEFAULT[B[1]] = B[6]
- }
+ _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2]
+ _SHORTCUTDEFAULT[B[1]] = B[6]
}
- } else {
- _fatal("_shortcut.init: _shortcut_struc: syntax error: `" _SHRTCUTA0[q] "'")
}
- }
- _SHRTCUTA1[""]
- delete _SHRTCUTA1[""]
- _shortcut_fpath = "\\\\localhost\\eGAWK\\LIB\\_shortcut\\_shortcut.exe"
- }
-
- function _shortcut_nerr(t, s, A)
- {
- if (match(t, /\x0ASystem error (-?[0-9]+)[^\x0D\x0A]*[\x0D\x0A]+([^\x0D\x0A]+)/, A)) {
- ERRNO = ((A[1] in _SHORTCUTERR ? _SHORTCUTERR[A[1]] : (A[2] in _SHORTCUTERR ? _SHORTCUTERR[A[2]] : tolower(gensub(/^(The )?(((.*)\.$)|(.*[^\.]$))/, "\\4\\5", "G", A[2])) "(" A[1] ")"))) ((s ? ": `" s "'" : ""))
} else {
- return 1
+ _fatal("_shortcut.init: _shortcut_struc: syntax error: `" _SHRTCUTA0[q] "'")
}
}
+ _SHRTCUTA1[""]
+ delete _SHRTCUTA1[""]
+ _shortcut_fpath = "\\\\localhost\\eGAWK\\LIB\\_shortcut\\_shortcut.exe"
+}
- function _split_regpath()
- {
- _rpp(" / / / / ")
- _rpp(" / / / / huj ")
- _rpp(" / / / / huj / ")
- _rpp(" / / / / huj / pizda.TSR ")
- _rpp(" / / / / hklm ")
- _rpp(" / / / / hklm / ")
- _rpp(" / / / / hklm / huj ")
- _rpp(" / / / / hklm / huj / ")
- _rpp(" / / / / hklm / huj / \tpizda.TSR ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _rpp(" / / / / hklm / software / altiris / fi le . ex t ")
- _rpp(" / / . / / hkcr / software / altiris / fi le . ex t ")
- _rpp(" / / ? / / hKcU / software / altiris / fi le . ex t ")
- _rpp(" / / lOcAlHoSt / / hKu / software / altiris / fi le . ex t ")
- _rpp(" / / ho st / / hKcc / software / altiris / fi le . ex t ")
- _rpp(" / / ho st / / hKPd / software / altiris / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- }
-
- function _splitpath_test()
- {
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" ")
- _fpp(" fi le . ex t ")
- _fpp(" di r0 / / ")
- _fpp(" di r0 / / fi le . ex t ")
- _fpp(" / ")
- _fpp(" / fi le . ex t ")
- _fpp(" / di r0 / / ")
- _fpp(" / di r0 / / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" c : ")
- _fpp(" c : fi le . ex t ")
- _fpp(" c : di r0 / / ")
- _fpp(" c : di r0 / / fi le . ex t ")
- _fpp(" c : / / ")
- _fpp(" c : / / fi le . ex t ")
- _fpp(" c : / / di r0 / / ")
- _fpp(" c : / / di r0 / / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" / / ")
- _fpp(" / / ho st . hs t ")
- _fpp(" / / ho st / / ")
- _fpp(" / / ho st / / fi le . ex t ")
- _fpp(" / / ho st / / di r0 / / ")
- _fpp(" / / ho st / / di r0 / / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" / / ho st / / c : ")
- _fpp(" / / ho st / / c : fi le . ex t ")
- _fpp(" / / ho st / / c : di r0 / / ")
- _fpp(" / / ho st / / c : di r0 / / fi le . ex t ")
- _fpp(" / / ho st / / c : / / ")
- _fpp(" / / ho st / / c : / / fi le . ex t ")
- _fpp(" / / ho st / / c : / / di r0 / / ")
- _fpp(" / / ho st / / c : / / di r0 / / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" http : / / / ")
- _fpp(" http : / / / si te . ex t ")
- _fpp(" http : / / / si te / / ")
- _fpp(" http : / / / si te / / fi le . ex t ")
- _fpp(" http : / / / si te / / di r0 / / ")
- _fpp(" http : / / / si te / / di r0 / / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" ftp : / / / : po rt ")
- _fpp(" ftp : / / / si te . ex t : po rt ")
- _fpp(" ftp : / / / si te : po rt / / ")
- _fpp(" ftp : / / / si te : po rt / / fi le . ex t ")
- _fpp(" ftp : / / / si te : po rt / / di r0 / / ")
- _fpp(" ftp : / / / si te : po rt / / di r0 / / fi le . ex t ")
- _conl()
- _conl("## //. ######################################################################################")
- _conl()
- _fpp(" / / . ")
- _fpp(" / / . / / ")
- _fpp(" / / . / / com 56 ")
- _fpp(" / / . / / com 56 / / ")
- _fpp(" / / . / / c : ")
- _fpp(" / / . / / c : / / ")
- _fpp(" / / . / / c : com 56 ")
- _fpp(" / / . / / c : com 56 / / ")
- _fpp(" / / . / / c : / / com 56 ")
- _fpp(" / / . / / c : / / com 56 / / ")
- _conl()
- _conl("## //? ######################################################################################")
- _conl()
- _fpp(" / / ? ")
- _fpp(" / / ? / / ")
- _fpp(" / / ? / / com 56 ")
- _fpp(" / / ? / / com 56 / / ")
- _fpp(" / / ? / / c : ")
- _fpp(" / / ? / / c : / / ")
- _fpp(" / / ? / / c : com 56 ")
- _fpp(" / / ? / / c : com 56 / / ")
- _fpp(" / / ? / / c : / / com 56 ")
- _fpp(" / / ? / / c : / / com 56 / / ")
- _conl()
- _conl("########################################################################################")
- _conl()
- _fpp(" / / / ")
- _fpp(" / / / . hs t ")
- _fpp(" / / / / fi le . ex t ")
- _fpp(" / / / / di r0 / / ")
- _fpp(" / / / / di r0 / / di r1 / fi le . ex t ")
- _fpp(" / / / / c : ")
- _fpp(" / / / / c : fi le . ex t ")
- _fpp(" / / / / c : di r0 / / ")
- _fpp(" / / / / c : di r0 / / fi le . ex t ")
- _fpp(" / / / / c : / / ")
- _fpp(" / / / / c : / / fi le . ex t ")
- _fpp(" / / / / c : / / di r0 / / ")
- _fpp(" / / / / c : / / di r0 / / fi le . ex t ")
- _conl()
- _conl("########################################################################################")
- _conl()
- return
+#_____________________________________________________
+function _shortcut_nerr(t, s, A)
+{
+ if (match(t, /\x0ASystem error (-?[0-9]+)[^\x0D\x0A]*[\x0D\x0A]+([^\x0D\x0A]+)/, A)) {
+ ERRNO = ((A[1] in _SHORTCUTERR ? _SHORTCUTERR[A[1]] : (A[2] in _SHORTCUTERR ? _SHORTCUTERR[A[2]] : tolower(gensub(/^(The )?(((.*)\.$)|(.*[^\.]$))/, "\\4\\5", "G", A[2])) "(" A[1] ")"))) ((s ? ": `" s "'" : ""))
+ } else {
+ return 1
}
-
- function _splitstr(A, t, r)
- {
- if (_istr(t)) {
- if (_splitstr_i0(A, t) > 0) {
- return _splitstrp0
- }
- if (_istr(r)) {
- return _splitstr_i0(A, r)
- }
- } else {
- if (it == "A") {
- if (length(t) > 0) {
- _movarr(A, t)
- return (0 - length(A))
- }
- }
- _istr(r)
- }
+}
+
+function _split_regpath()
+{
+ _rpp(" / / / / ")
+ _rpp(" / / / / huj ")
+ _rpp(" / / / / huj / ")
+ _rpp(" / / / / huj / pizda.TSR ")
+ _rpp(" / / / / hklm ")
+ _rpp(" / / / / hklm / ")
+ _rpp(" / / / / hklm / huj ")
+ _rpp(" / / / / hklm / huj / ")
+ _rpp(" / / / / hklm / huj / \tpizda.TSR ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _rpp(" / / / / hklm / software / altiris / fi le . ex t ")
+ _rpp(" / / . / / hkcr / software / altiris / fi le . ex t ")
+ _rpp(" / / ? / / hKcU / software / altiris / fi le . ex t ")
+ _rpp(" / / lOcAlHoSt / / hKu / software / altiris / fi le . ex t ")
+ _rpp(" / / ho st / / hKcc / software / altiris / fi le . ex t ")
+ _rpp(" / / ho st / / hKPd / software / altiris / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+}
+
+function _splitpath_test()
+{
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" ")
+ _fpp(" fi le . ex t ")
+ _fpp(" di r0 / / ")
+ _fpp(" di r0 / / fi le . ex t ")
+ _fpp(" / ")
+ _fpp(" / fi le . ex t ")
+ _fpp(" / di r0 / / ")
+ _fpp(" / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" c : ")
+ _fpp(" c : fi le . ex t ")
+ _fpp(" c : di r0 / / ")
+ _fpp(" c : di r0 / / fi le . ex t ")
+ _fpp(" c : / / ")
+ _fpp(" c : / / fi le . ex t ")
+ _fpp(" c : / / di r0 / / ")
+ _fpp(" c : / / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" / / ")
+ _fpp(" / / ho st . hs t ")
+ _fpp(" / / ho st / / ")
+ _fpp(" / / ho st / / fi le . ex t ")
+ _fpp(" / / ho st / / di r0 / / ")
+ _fpp(" / / ho st / / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" / / ho st / / c : ")
+ _fpp(" / / ho st / / c : fi le . ex t ")
+ _fpp(" / / ho st / / c : di r0 / / ")
+ _fpp(" / / ho st / / c : di r0 / / fi le . ex t ")
+ _fpp(" / / ho st / / c : / / ")
+ _fpp(" / / ho st / / c : / / fi le . ex t ")
+ _fpp(" / / ho st / / c : / / di r0 / / ")
+ _fpp(" / / ho st / / c : / / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" http : / / / ")
+ _fpp(" http : / / / si te . ex t ")
+ _fpp(" http : / / / si te / / ")
+ _fpp(" http : / / / si te / / fi le . ex t ")
+ _fpp(" http : / / / si te / / di r0 / / ")
+ _fpp(" http : / / / si te / / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" ftp : / / / : po rt ")
+ _fpp(" ftp : / / / si te . ex t : po rt ")
+ _fpp(" ftp : / / / si te : po rt / / ")
+ _fpp(" ftp : / / / si te : po rt / / fi le . ex t ")
+ _fpp(" ftp : / / / si te : po rt / / di r0 / / ")
+ _fpp(" ftp : / / / si te : po rt / / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("## //. ######################################################################################")
+ _conl()
+ _fpp(" / / . ")
+ _fpp(" / / . / / ")
+ _fpp(" / / . / / com 56 ")
+ _fpp(" / / . / / com 56 / / ")
+ _fpp(" / / . / / c : ")
+ _fpp(" / / . / / c : / / ")
+ _fpp(" / / . / / c : com 56 ")
+ _fpp(" / / . / / c : com 56 / / ")
+ _fpp(" / / . / / c : / / com 56 ")
+ _fpp(" / / . / / c : / / com 56 / / ")
+ _conl()
+ _conl("## //? ######################################################################################")
+ _conl()
+ _fpp(" / / ? ")
+ _fpp(" / / ? / / ")
+ _fpp(" / / ? / / com 56 ")
+ _fpp(" / / ? / / com 56 / / ")
+ _fpp(" / / ? / / c : ")
+ _fpp(" / / ? / / c : / / ")
+ _fpp(" / / ? / / c : com 56 ")
+ _fpp(" / / ? / / c : com 56 / / ")
+ _fpp(" / / ? / / c : / / com 56 ")
+ _fpp(" / / ? / / c : / / com 56 / / ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _fpp(" / / / ")
+ _fpp(" / / / . hs t ")
+ _fpp(" / / / / fi le . ex t ")
+ _fpp(" / / / / di r0 / / ")
+ _fpp(" / / / / di r0 / / di r1 / fi le . ex t ")
+ _fpp(" / / / / c : ")
+ _fpp(" / / / / c : fi le . ex t ")
+ _fpp(" / / / / c : di r0 / / ")
+ _fpp(" / / / / c : di r0 / / fi le . ex t ")
+ _fpp(" / / / / c : / / ")
+ _fpp(" / / / / c : / / fi le . ex t ")
+ _fpp(" / / / / c : / / di r0 / / ")
+ _fpp(" / / / / c : / / di r0 / / fi le . ex t ")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ return
+}
+
+#_______________________________________________________________________
+function _splitstr(A, t, r)
+{
+ ########################################### 1 #
+ if (_istr(t)) {
+ if (_splitstr_i0(A, t) > 0) {
+ return _splitstrp0
+ }
+ if (_istr(r)) {
+ return _splitstr_i0(A, r)
+ }
+ } else {
if (it == "A") {
- if (length(r) > 0) {
- _movarr(A, r)
+ if (length(t) > 0) {
+ _movarr(A, t)
return (0 - length(A))
}
}
+ _istr(r)
}
-
- function _splitstr_i0(A, t, C)
- {
- if (2 > (_splitstrq0 = patsplit(t, _SPLITSTRA0, /([^,\xB4]*\xB4.)*[^,\xB4]*/))) {
- _splitstrq0 = split(gensub(/\xB4(.)/, "\\1", "G", t), _SPLITSTRA0, "")
+ if (it == "A") {
+ if (length(r) > 0) {
+ _movarr(A, r)
+ return (0 - length(A))
}
- delete A
- _splitstri0 = _splitstrp0 = 0
- while (_splitstri0++ < _splitstrq0) {
- if ((t = gensub(/\xB4(.)/, "\\1", "G", _SPLITSTRA0[_splitstri0])) in C || t == "") {
- continue
- }
- C[A[++_splitstrp0] = t]
- }
- return _splitstrp0
}
+}
- function _strtorexp(t)
- {
- gsub(/[\\\.\?\*\+\-\(\)\{\}\[\]\^\$\/\|]/, "\\\\&", t)
- t = split(t, _TOREXP_STRA, /[\x00-\x1F]/, _TOREXP_STRB)
- _torexp_strt0 = ""
- for (_torexp_stri0 = 1; _torexp_stri0 < t; _torexp_stri0++) {
- _torexp_strt0 = _torexp_strt0 _TOREXP_STRA[_torexp_stri0] "\\" _QASC[_TOREXP_STRB[_torexp_stri0]]
+#_____________________________________________________
+function _splitstr_i0(A, t, C)
+{
+ if (2 > (_splitstrq0 = patsplit(t, _SPLITSTRA0, /([^,\xB4]*\xB4.)*[^,\xB4]*/))) {
+ _splitstrq0 = split(gensub(/\xB4(.)/, "\\1", "G", t), _SPLITSTRA0, "")
+ }
+ delete A
+ _splitstri0 = _splitstrp0 = 0
+ while (_splitstri0++ < _splitstrq0) {
+ if ((t = gensub(/\xB4(.)/, "\\1", "G", _SPLITSTRA0[_splitstri0])) in C || t == "") {
+ continue
}
- return (_torexp_strt0 _TOREXP_STRA[_torexp_stri0])
+ C[A[++_splitstrp0] = t]
}
+ return _splitstrp0
+}
- function _subseqoff(r, B)
- {
- patsplit(r, B, /\x84[^\x94]*\x94/)
- return gensub(/\x84[^\x94]*\x94/, "\204", "G", r)
+#_______________________________________________
+function _strtorexp(t)
+{
+ gsub(/[\\\.\?\*\+\-\(\)\{\}\[\]\^\$\/\|]/, "\\\\&", t)
+ t = split(t, _TOREXP_STRA, /[\x00-\x1F]/, _TOREXP_STRB)
+ _torexp_strt0 = ""
+ for (_torexp_stri0 = 1; _torexp_stri0 < t; _torexp_stri0++) {
+ _torexp_strt0 = _torexp_strt0 _TOREXP_STRA[_torexp_stri0] "\\" _QASC[_TOREXP_STRB[_torexp_stri0]]
}
+ return (_torexp_strt0 _TOREXP_STRA[_torexp_stri0])
+}
- function _subseqon(B, r, F, f, s, e, q, i, A)
- {
- q = split(r, A, /\x84/)
- r = ""
- f = F[""]
- for (i = 1; i < q; i++) {
- s = substr(e = B[i], 2, 1)
- s = (s in F ? F[s] : F[""])
- r = r (@f(A[i])) (@s(substr(e, 3, length(e) - 3)))
- }
- return (r (@f(A[i])))
- }
+function _subseqoff(r, B)
+{
+ patsplit(r, B, /\x84[^\x94]*\x94/)
+ return gensub(/\x84[^\x94]*\x94/, "\204", "G", r)
+}
- function _sysinfo(D, h)
- {
- h = "wmic /NODE: \"" h "\" OS 2>NUL"
- if (split(_cmd(h), _SYSINFOA0, /[\x0D\x0A]+/) == 3) {
- _sysinfol0 = length(h = _SYSINFOA0[2]) + 1
- _sysinfoq0 = _sysinfoq1 = split(_SYSINFOA0[1], _SYSINFOA0, / +/, _SYSINFOB0)
- while (--_sysinfoq0 > 0) {
- D[_sysinfof0] = gensub(/^ +| +$/, "", "G", substr(h, _sysinfol0 = _sysinfol0 - (_sysinfol1 = length(_sysinfof0 = _SYSINFOA0[_sysinfoq0]) + length(_SYSINFOB0[_sysinfoq0])), _sysinfol1))
- }
- return (_sysinfoq1 - 1)
- }
+function _subseqon(B, r, F, f, s, e, q, i, A)
+{
+ q = split(r, A, /\x84/)
+ r = ""
+ f = F[""]
+ for (i = 1; i < q; i++) {
+ s = substr(e = B[i], 2, 1)
+ #_conl("curr r==`" r "': A[" i "]=`" A[i] "'")
+ #s=s in F ? _th0(F[s],_conl("handler `" F[s] "' for `" s "' ost=`" substr(e,3,length(e)-3) "'")) : _th0(F[""],_conl("default handler for `" s "'"))
+ s = (s in F ? F[s] : F[""])
+ #_conl("`" f "'")
+ r = r (@f(A[i])) (@s(substr(e, 3, length(e) - 3)))
}
+ return (r (@f(A[i])))
+}
- function _tOBJ(c, t, P)
- {
- switch (c) {
- case "_lib_CMDLN":
- return t
- case "_lib_APPLY":
- return
- case "_lib_HELP":
- return
- case "_lib_NAMEVER":
- return _ln("_tOBJ 3.0")
- case "_lib_BEGIN":
- return
- case "_lib_END":
- return
- case "_lib_CLEANUP":
- return _tOBJ_CLEANUP()
- }
- }
+#_____________________________________________________________________________
+# _rdreg(ARRAY,reg_path)
+# Import into ARRAY the content of the whole registree tree with the higher point specified by reg_path.
+# ARRAY will be filled by the strings with following format:
+#
+# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GnuWin32\CoreUtils\5.3.0\pck\InstallPath.STR=C:\Program Files (x86)\GnuWin32
+# where:
+# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GnuWin32\CoreUtils\5.3.0\pck <- REG KEY PATH
+# InstallPath <- DATA FIELD
+# STR <- TYPE
+# C:\Program Files (x86)\GnuWin32 <- VALUE
+# TYPE:
+# STR - REG_SZ (String Value)
+# W32 - REG_DWORD (DWORD (32-bit) Value)
+# W64 - REG_QWORD (QWORD (64-bit) Value)
+# BIN - REG_BINARY (Binary Value)
+# XSZ - REG_EXPAND_SZ (Expandable String Value)
+# MSZ - REG_MULTI_SZ (Multi-String Value)
+#_________________________________________________________________________________________
- function _tOBJ_CLEANUP(p)
- {
- for (p in UIDSDEL) {
- delete _ptr[p]
- delete _tPREV[p]
- delete _tPARENT[p]
- delete _tNEXT[p]
- delete _tFCHLD[p]
- delete _tQCHLD[p]
- delete _tLCHLD[p]
- delete _TMP0[p]
- delete _TMP1[p]
- delete _tLINK[p]
- delete _tCLASS[p]
- }
- }
- function _tabtospc(t, ts, xc, a, c, n, A, B)
- {
- if (! ts) {
- ts = _TAB_STEP_DEFAULT
- }
- c = split("." t, A, /\t+/, B)
- A[1] = substr(A[1], 2)
- t = ""
- for (n = 1; n <= c; n++) {
- t = t A[n] _getchrln(" ", (xc = length(B[n]) * ts + int((a = xc + length(A[n])) / ts) * ts) - a)
- }
- return t
- }
- function _tapi(p, f, p0, p1, p2, p3, c)
- {
- c = p
- do {
- if (f in _[c]["API"]) {
- f = _[c]["API"][f]
- return @f(p, p0, p1, p2, p3)
- }
- c = _[c]["CLASS"]
- } while ("CLASS" in _[c])
- }
- function _tbframe(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tbframe_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
- }
+# HKCR HKEY_CLASSES_ROOT
+# HKCU HKEY_CURRENT_USER
+# HKLM HKEY_LOCAL_MACHINE
+# HKU HKEY_USERS
+# HKCC HKEY_CURRENT_CONFIG
+# HKPD HKEY_PERFORMANCE_DATA
- function _tbframe_i0(f, p, p0, p1, a)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tLCHLD ? _tmbframe(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
- }
- function _tbframex(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tbframex_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
- }
- function _tbframex_i0(f, p, p0, p1)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tLCHLD ? _tmbframex(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
- }
- function _tbpass(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tbpass_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
- }
- function _tbpass_i0(f, p, p0, p1, a)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tLCHLD ? _tmbpass(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
- }
- function _tbpassx(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tbpassx_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
- }
- function _tbpassx_i0(f, p, p0, p1)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tLCHLD ? _tmbpassx(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
- }
- function _tbrochld(p, f, pp)
- {
- if (p) {
- if (p in _tFCHLD) {
- f = _tFCHLD[p]
- delete _tFCHLD[p]
- delete _tLCHLD[p]
- if (p in _tPARENT) {
- pp = _tPARENT[p]
- delete _tPARENT[p]
- if (p in _tPREV) {
- _tNEXT[_tPREV[f] = _tPREV[p]] = f
- delete _tPREV[p]
- } else {
- _tFCHLD[pp] = f
- }
- for (; f in _tNEXT; f = _tNEXT[f]) {
- _tPARENT[f] = pp
- }
- _tPARENT[f] = pp
- if (p in _tNEXT) {
- _tPREV[_tNEXT[f] = _tNEXT[p]] = f
- delete _tNEXT[p]
- } else {
- _tLCHLD[pp] = f
- }
- _tQCHLD[pp] = _tQCHLD[pp] + _tQCHLD[p] - 1
- delete _tQCHLD[p]
- return f
- } else {
- delete _tQCHLD[p]
- if (p in _tPREV) {
- _tNEXT[_tPREV[f] = _tPREV[p]] = f
- delete _tPREV[p]
- }
- for (; f in _tNEXT; f = _tNEXT[f]) {
- delete _tPARENT[f]
- }
- delete _tPARENT[f]
- if (p in _tNEXT) {
- _tPREV[_tNEXT[f] = _tNEXT[p]] = f
- delete _tNEXT[p]
- }
- return f
- }
- } else {
- if (p in _tPARENT) {
- pp = _tPARENT[p]
- delete _tPARENT[p]
- if (p in _tPREV) {
- if (p in _tNEXT) {
- _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p]
- delete _tNEXT[p]
- } else {
- delete _tNEXT[_tLCHLD[pp] = _tPREV[p]]
- }
- delete _tPREV[p]
- _tQCHLD[pp]--
- } else {
- if (p in _tNEXT) {
- delete _tPREV[_tFCHLD[pp] = _tNEXT[p]]
- delete _tNEXT[p]
- _tQCHLD[pp]--
- } else {
- delete _tFCHLD[pp]
- delete _tLCHLD[pp]
- delete _tQCHLD[pp]
- }
- }
- } else {
- if (p in _tPREV) {
- if (p in _tNEXT) {
- _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p]
- delete _tNEXT[p]
- } else {
- delete _tNEXT[_tPREV[p]]
- }
- delete _tPREV[p]
- } else {
- if (p in _tNEXT) {
- delete _tPREV[_tNEXT[p]]
- delete _tNEXT[p]
- }
- }
- }
- }
- }
- return p
- }
- function _tbrunframe(f, p, p0, p1)
- {
- return _tbframe((f ? f : "_trunframe_i0"), p, p0, p1)
- }
- function _tbrunframex(f, p, p0, p1)
- {
- return _tbframex((f ? f : "_trunframe_i0"), p, p0, p1)
- }
- function _tbrunpass(f, p, p0, p1)
- {
- return _tbpass((f ? f : "_trunframe_i0"), p, p0, p1)
- }
- function _tbrunpassx(f, p, p0, p1)
- {
- return _tbpassx((f ? f : "_trunframe_i0"), p, p0, p1)
- }
- function _tdel(p, i)
- {
- if (p in _) {
- _texclude(p)
- for (i in _ptr[p]) {
- if (isarray(_ptr[p][i])) {
- _tdel_i1(_ptr[p][i])
- } else {
- if (i = _ptr[p][i]) {
- _tdel(i)
- }
- }
- }
- if (p in _tFCHLD) {
- i = _tFCHLD[p]
- do {
- i = ((i in _tNEXT ? _tNEXT[i] : "")) _tdel_i0(i)
- } while (i)
- }
- delete _[p]
- _UIDSDEL[p]
- }
- }
- function _tdel_i0(p, i)
- {
- for (i in _ptr[p]) {
- if (isarray(_ptr[p][i])) {
- _tdel_i1(_ptr[p][i])
- } else {
- if (i = _ptr[p][i]) {
- _tdel(i)
- }
- }
- }
- if (p in _tFCHLD) {
- i = _tFCHLD[p]
- do {
- i = ((i in _tNEXT ? _tNEXT[i] : "")) _tdel_i0(i)
- } while (i)
- }
- delete _[p]
- _UIDSDEL[p]
- }
- function _tdel_i1(A, i)
- {
- for (i in A) {
- if (isarray(A[i])) {
- _tdel_i1(A[i])
- } else {
- if (i = A[i]) {
- _tdel(i)
- }
- }
- }
- }
- function _tdelete(p, v)
- {
- if (p) {
- _wLCHLD(_tDELPTR, p)
- }
- return v
- }
- function _tdelitem(p)
- {
- if (p) {
- if ("HOST" in _PTR[p] && "ITEMNAME" in _[p]) {
- return _wLCHLD(_PTR[_PTR[p]["HOST"]]["ITEM"][_[p]["ITEMNAME"]], p)
- }
- _tdelete(p)
- return p
- }
- }
- function _tend(a, b)
- {
- if (b == "") {
- return (_t_ENDF[_t_ENDF[0]] = a)
- } else {
- return (_t_ENDF[_t_ENDF[0] + a] = b)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#___________________________________________________________________________________
+####################################################################################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+function _sysinfo(D, h)
+{
+ ##############################################################
+ h = "wmic /NODE: \"" h "\" OS 2>NUL"
+ if (split(_cmd(h), _SYSINFOA0, /[\x0D\x0A]+/) == 3) {
+ _sysinfol0 = length(h = _SYSINFOA0[2]) + 1
+ _sysinfoq0 = _sysinfoq1 = split(_SYSINFOA0[1], _SYSINFOA0, / +/, _SYSINFOB0)
+ while (--_sysinfoq0 > 0) {
+ D[_sysinfof0] = gensub(/^ +| +$/, "", "G", substr(h, _sysinfol0 = _sysinfol0 - (_sysinfol1 = length(_sysinfof0 = _SYSINFOA0[_sysinfoq0]) + length(_SYSINFOB0[_sysinfoq0])), _sysinfol1))
}
+ return (_sysinfoq1 - 1)
}
+}
- function _texclude(p, v, pp)
- {
- if (p in _) {
+#########################################################
+
+function _tOBJ(c, t, P)
+{
+ switch (c) {
+ case "_lib_CMDLN":
+ #___________________________________________________________
+ return t
+ #___________________________________________________________
+ case "_lib_APPLY":
+ return
+ #___________________________________________________________
+ case "_lib_HELP":
+ return
+ #___________________________________________________________
+ case "_lib_NAMEVER":
+ return _ln("_tOBJ 3.0")
+ #___________________________________________________________
+ case "_lib_BEGIN":
+ return
+ #___________________________________________________________
+ case "_lib_END":
+ return
+ #___________________________________________________________
+ case "_lib_CLEANUP":
+ return _tOBJ_CLEANUP()
+ }
+}
+
+#_______________________________________________________________________
+function _tOBJ_CLEANUP(p)
+{
+ ##############################################
+ for (p in UIDSDEL) {
+ delete _ptr[p]
+ delete _tPREV[p]
+ delete _tPARENT[p]
+ delete _tNEXT[p]
+ delete _tFCHLD[p]
+ delete _tQCHLD[p]
+ delete _tLCHLD[p]
+ delete _TMP0[p]
+ delete _TMP1[p]
+ delete _tLINK[p]
+ delete _tCLASS[p]
+ }
+}
+
+#_______________________________________________________________________
+function _tabtospc(t, ts, xc, a, c, n, A, B)
+{
+ ##################################
+ if (! ts) {
+ ts = _TAB_STEP_DEFAULT
+ }
+ c = split("." t, A, /\t+/, B)
+ A[1] = substr(A[1], 2)
+ t = ""
+ for (n = 1; n <= c; n++) {
+ t = t A[n] _getchrln(" ", (xc = length(B[n]) * ts + int((a = xc + length(A[n])) / ts) * ts) - a)
+ }
+ return t
+}
+
+#___________________________________________________________________________________
+####################################################################################
+
+
+
+
+
+
+
+function _tapi(p, f, p0, p1, p2, p3, c)
+{
+ c = p
+ do {
+ if (f in _[c]["API"]) {
+ f = _[c]["API"][f]
+ return @f(p, p0, p1, p2, p3)
+ }
+ c = _[c]["CLASS"]
+ } while ("CLASS" in _[c])
+}
+
+#_____________________________________________________________________________
+function _tbframe(f, p, p0, p1)
+{
+ ##################################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tbframe_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tbframe_i0(f, p, p0, p1, a)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tLCHLD ? _tmbframe(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_______________________________________________________________________
+function _tbframex(f, p, p0, p1)
+{
+ ###########################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tbframex_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tbframex_i0(f, p, p0, p1)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tLCHLD ? _tmbframex(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_____________________________________________________________________________
+function _tbpass(f, p, p0, p1)
+{
+ ###################################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tbpass_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tbpass_i0(f, p, p0, p1, a)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tLCHLD ? _tmbpass(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_____________________________________________________________________________
+function _tbpassx(f, p, p0, p1)
+{
+ ##################################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tbpassx_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tbpassx_i0(f, p, p0, p1)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tLCHLD ? _tmbpassx(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_____________________________________________________________________________
+function _tbrochld(p, f, pp)
+{
+ ################################################### # TEST!!!
+ if (p) {
+ if (p in _tFCHLD) {
+ f = _tFCHLD[p]
+ delete _tFCHLD[p]
+ delete _tLCHLD[p]
+ if (p in _tPARENT) {
+ pp = _tPARENT[p]
+ delete _tPARENT[p]
+ if (p in _tPREV) {
+ _tNEXT[_tPREV[f] = _tPREV[p]] = f
+ delete _tPREV[p]
+ } else {
+ _tFCHLD[pp] = f
+ }
+ for (; f in _tNEXT; f = _tNEXT[f]) {
+ _tPARENT[f] = pp
+ }
+ _tPARENT[f] = pp
+ if (p in _tNEXT) {
+ _tPREV[_tNEXT[f] = _tNEXT[p]] = f
+ delete _tNEXT[p]
+ } else {
+ _tLCHLD[pp] = f
+ }
+ _tQCHLD[pp] = _tQCHLD[pp] + _tQCHLD[p] - 1
+ delete _tQCHLD[p]
+ return f
+ } else {
+ delete _tQCHLD[p]
+ if (p in _tPREV) {
+ _tNEXT[_tPREV[f] = _tPREV[p]] = f
+ delete _tPREV[p]
+ }
+ for (; f in _tNEXT; f = _tNEXT[f]) {
+ delete _tPARENT[f]
+ }
+ delete _tPARENT[f]
+ if (p in _tNEXT) {
+ _tPREV[_tNEXT[f] = _tNEXT[p]] = f
+ delete _tNEXT[p]
+ }
+ return f
+ }
+ } else {
if (p in _tPARENT) {
pp = _tPARENT[p]
delete _tPARENT[p]
if (p in _tPREV) {
if (p in _tNEXT) {
- _tPREV[_tNEXT[v] = _tNEXT[p]] = v = _tPREV[p]
+ _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p]
delete _tNEXT[p]
} else {
delete _tNEXT[_tLCHLD[pp] = _tPREV[p]]
}
delete _tPREV[p]
+ _tQCHLD[pp]--
} else {
if (p in _tNEXT) {
delete _tPREV[_tFCHLD[pp] = _tNEXT[p]]
delete _tNEXT[p]
+ _tQCHLD[pp]--
} else {
delete _tFCHLD[pp]
delete _tLCHLD[pp]
delete _tQCHLD[pp]
- return p
}
}
- --_tQCHLD[pp]
} else {
if (p in _tPREV) {
if (p in _tNEXT) {
- _tPREV[_tNEXT[v] = _tNEXT[p]] = v = _tPREV[p]
+ _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p]
delete _tNEXT[p]
} else {
delete _tNEXT[_tPREV[p]]
@@ -4777,1133 +5735,1521 @@
}
}
}
- return p
- }
- }
-
- function _tframe(fF, p, p0, p1, p2)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- p = (_isptr(p) ? (isarray(fF) ? _tframe_i1(fF, p, p0, p1, p2) : _tframe_i0(fF, p, p0, p1, p2)) : "")
- --_t_ENDF[0]
- return p
- }
-
- function _tframe0(f, p, p0, p1, p2, p3, A)
- {
- if (_isptr(p)) {
- if (isarray(f)) {
- return _tframe0_i0(f, p)
- }
- _tframex_p0(A, f, 0)
- return _th0(_tframe0_i0(A, p), --_TEND[_ARRLEN])
}
}
-
- function _tframe0_i0(A, p, f)
- {
- if (p in _tLINK) {
- _tframe_link = p
- if ("`" in A) {
- f = A["`"]
- while (p in _tLINK) {
- @f(p = _tLINK[p])
- }
+ return p
+}
+
+#_________________________________________________________________
+function _tbrunframe(f, p, p0, p1)
+{
+ ###################################
+ return _tbframe((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_________________________________________________________________
+function _tbrunframex(f, p, p0, p1)
+{
+ ##################################
+ return _tbframex((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_________________________________________________________________
+function _tbrunpass(f, p, p0, p1)
+{
+ ####################################
+ return _tbpass((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_________________________________________________________________
+function _tbrunpassx(f, p, p0, p1)
+{
+ ###################################
+ return _tbpassx((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_____________________________________________________________________________
+function _tdel(p, i)
+{
+ ##########################################################
+ if (p in _) {
+ _texclude(p)
+ for (i in _ptr[p]) {
+ if (isarray(_ptr[p][i])) {
+ _tdel_i1(_ptr[p][i])
} else {
- while (p in _tLINK) {
- p = _tLINK[p]
+ if (i = _ptr[p][i]) {
+ _tdel(i)
}
}
- } else {
- _tframe_link = ""
}
if (p in _tFCHLD) {
- return (_tframe0_i2(A, "^", p) _tframe0_i1(A, _tFCHLD[p]))
+ i = _tFCHLD[p]
+ do {
+ i = ((i in _tNEXT ? _tNEXT[i] : "")) _tdel_i0(i)
+ } while (i)
}
- return _tframe0_i2(A, ".", p)
+ delete _[p]
+ _UIDSDEL[p]
}
+}
- function _tframe0_i1(A, p)
- {
- if (_TEND[_ARRLEN] in _TEND) {
- return
- }
- if (p in _tNEXT) {
- return (_tframe0_i0(A, p) _tframe0_i1(A, _tNEXT[p]))
+#_____________________________________________________
+function _tdel_i0(p, i)
+{
+ for (i in _ptr[p]) {
+ if (isarray(_ptr[p][i])) {
+ _tdel_i1(_ptr[p][i])
+ } else {
+ if (i = _ptr[p][i]) {
+ _tdel(i)
+ }
}
- return _tframe0_i0(A, p)
}
-
- function _tframe0_i2(A, m, p)
- {
- _tframe_dlink = p
- while (p in _tDLINK) {
- p = _tDLINK[p]
- }
- if (m in A) {
- if (m "~" in A) {
- if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
- return
- }
+ if (p in _tFCHLD) {
+ i = _tFCHLD[p]
+ do {
+ i = ((i in _tNEXT ? _tNEXT[i] : "")) _tdel_i0(i)
+ } while (i)
+ }
+ delete _[p]
+ _UIDSDEL[p]
+}
+
+#_____________________________________________________
+function _tdel_i1(A, i)
+{
+ for (i in A) {
+ if (isarray(A[i])) {
+ _tdel_i1(A[i])
+ } else {
+ if (i = A[i]) {
+ _tdel(i)
}
- m = A[m]
- return @m(p)
}
}
+}
- function _tframe1(f, p, p0, p1, p2, p3, A)
- {
- if (_isptr(p)) {
- if (isarray(f)) {
- return _tframe1_i0(f, p, p0)
- }
- _tframex_p0(A, f, 1)
- return _th0(_tframe1_i0(A, p, p0), --_TEND[_ARRLEN])
- }
+#_____________________________________________________________________________
+function _tdelete(p, v)
+{
+ ####################################################### # REMAKE EXCLUDE
+ if (p) {
+ _wLCHLD(_tDELPTR, p)
}
+ return v
+}
- function _tframe1_i0(A, p, p0)
- {
- _tframe_link = p
- while (p in _tLINK) {
- p = _tLINK[p]
+#_________________________________________________________________
+function _tdelitem(p)
+{
+ #############################################
+ if (p) {
+ if ("HOST" in _PTR[p] && "ITEMNAME" in _[p]) {
+ return _wLCHLD(_PTR[_PTR[p]["HOST"]]["ITEM"][_[p]["ITEMNAME"]], p)
}
- if (p in _tFCHLD) {
- return (_tframe1_i2(A, "^", p, p0) _tframe1_i1(A, _tFCHLD[p], p0))
- }
- return _tframe1_i2(A, ".", p, p0)
+ _tdelete(p)
+ return p
}
+}
- function _tframe1_i1(A, p, p0)
- {
- if (_TEND[_ARRLEN] in _TEND) {
- return
- }
- if (p in _tNEXT) {
- return (_tframe1_i0(A, p, p0) _tframe1_i1(A, _tNEXT[p], p0))
- }
- return _tframe1_i0(A, p, p0)
+#_______________________________________________________________________
+function _tend(a, b)
+{
+ #####################################################
+ if (b == "") {
+ return (_t_ENDF[_t_ENDF[0]] = a)
+ } else {
+ return (_t_ENDF[_t_ENDF[0] + a] = b)
}
+}
- function _tframe1_i2(A, m, p, p0)
- {
- _tframe_dlink = p
- while (p in _tDLINK) {
- p = _tDLINK[p]
- }
- if (m in A) {
- if (m "~" in A) {
- if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
- return
+#_____________________________________________________________________________
+function _texclude(p, v, pp)
+{
+ ################################################### # TEST!!!
+ if (p in _) {
+ if (p in _tPARENT) {
+ pp = _tPARENT[p]
+ delete _tPARENT[p]
+ if (p in _tPREV) {
+ if (p in _tNEXT) {
+ _tPREV[_tNEXT[v] = _tNEXT[p]] = v = _tPREV[p]
+ delete _tNEXT[p]
+ } else {
+ delete _tNEXT[_tLCHLD[pp] = _tPREV[p]]
+ }
+ delete _tPREV[p]
+ } else {
+ if (p in _tNEXT) {
+ delete _tPREV[_tFCHLD[pp] = _tNEXT[p]]
+ delete _tNEXT[p]
+ } else {
+ delete _tFCHLD[pp]
+ delete _tLCHLD[pp]
+ delete _tQCHLD[pp]
+ return p
}
}
- m = A[m]
- return @m(p, p0)
- }
- }
-
- function _tframe2(f, p, p0, p1, p2, p3, A)
- {
- if (_isptr(p)) {
- if (isarray(f)) {
- return _tframe2_i0(f, p, p0, p1)
+ --_tQCHLD[pp]
+ } else {
+ if (p in _tPREV) {
+ if (p in _tNEXT) {
+ _tPREV[_tNEXT[v] = _tNEXT[p]] = v = _tPREV[p]
+ delete _tNEXT[p]
+ } else {
+ delete _tNEXT[_tPREV[p]]
+ }
+ delete _tPREV[p]
+ } else {
+ if (p in _tNEXT) {
+ delete _tPREV[_tNEXT[p]]
+ delete _tNEXT[p]
+ }
}
- _tframex_p0(A, f, 2)
- return _th0(_tframe2_i0(A, p, p0, p1), --_TEND[_ARRLEN])
}
+ return p
}
-
- function _tframe2_i0(A, p, p0, p1)
- {
+}
+
+# _tDLINK progressive development: concrete _tDLINK function\processing algo; all frame's families support
+#_____________________________________________________________________________
+function _tframe(fF, p, p0, p1, p2)
+{
+ ###############################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ p = (_isptr(p) ? (isarray(fF) ? _tframe_i1(fF, p, p0, p1, p2) : _tframe_i0(fF, p, p0, p1, p2)) : "")
+ --_t_ENDF[0]
+ return p
+}
+
+#_____________________________________________________________________________
+function _tframe0(f, p, p0, p1, p2, p3, A)
+{
+ #########################################
+ if (_isptr(p)) {
+ if (isarray(f)) {
+ return _tframe0_i0(f, p)
+ }
+ _tframex_p0(A, f, 0)
+ return _th0(_tframe0_i0(A, p), --_TEND[_ARRLEN])
+ }
+}
+
+#_______________________________________________
+function _tframe0_i0(A, p, f)
+{
+ if (p in _tLINK) {
_tframe_link = p
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- if (p in _tFCHLD) {
- return (_tframe2_i2(A, "^", p, p0, p1) _tframe2_i1(A, _tFCHLD[p], p0, p1))
+ if ("`" in A) {
+ f = A["`"]
+ while (p in _tLINK) {
+ @f(p = _tLINK[p])
+ }
+ } else {
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
}
- return _tframe2_i2(A, ".", p, p0, p1)
+ } else {
+ _tframe_link = ""
}
-
- function _tframe2_i1(A, p, p0, p1)
- {
- if (_TEND[_ARRLEN] in _TEND) {
- return
- }
- if (p in _tNEXT) {
- return (_tframe2_i0(A, p, p0, p1) _tframe2_i1(A, _tNEXT[p], p0, p1))
- }
- return _tframe2_i0(A, p, p0, p1)
+ if (p in _tFCHLD) {
+ return (_tframe0_i2(A, "^", p) _tframe0_i1(A, _tFCHLD[p]))
}
+ return _tframe0_i2(A, ".", p)
+}
- function _tframe2_i2(A, m, p, p0, p1)
- {
- _tframe_dlink = p
- while (p in _tDLINK) {
- p = _tDLINK[p]
- }
- if (m in A) {
- if (m "~" in A) {
- if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
- return
- }
- }
- m = A[m]
- return @m(p, p0, p1)
- }
+#_______________________________________________
+function _tframe0_i1(A, p)
+{
+ if (_TEND[_ARRLEN] in _TEND) {
+ return
}
+ if (p in _tNEXT) {
+ return (_tframe0_i0(A, p) _tframe0_i1(A, _tNEXT[p]))
+ }
+ return _tframe0_i0(A, p)
+}
- function _tframe3(f, p, p0, p1, p2, p3, A)
- {
- if (_isptr(p)) {
- if (isarray(f)) {
- return _tframe3_i0(f, p, p0, p1, p2)
+#_______________________________________________
+function _tframe0_i2(A, m, p)
+{
+ _tframe_dlink = p
+ while (p in _tDLINK) {
+ p = _tDLINK[p]
+ }
+ if (m in A) {
+ if (m "~" in A) {
+ if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
+ return
}
- _tframex_p0(A, f, 3)
- return _th0(_tframe3_i0(A, p, p0, p1, p2), --_TEND[_ARRLEN])
}
+ m = A[m]
+ return @m(p)
}
+}
- function _tframe3_i0(A, p, p0, p1, p2)
- {
- _tframe_link = p
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- if (p in _tFCHLD) {
- return (_tframe3_i2(A, "^", p, p0, p1, p2) _tframe3_i1(A, _tFCHLD[p], p0, p1, p2))
+#_________________________________________________________________
+function _tframe1(f, p, p0, p1, p2, p3, A)
+{
+ #############################
+ if (_isptr(p)) {
+ if (isarray(f)) {
+ return _tframe1_i0(f, p, p0)
}
- return _tframe3_i2(A, ".", p, p0, p1, p2)
+ _tframex_p0(A, f, 1)
+ return _th0(_tframe1_i0(A, p, p0), --_TEND[_ARRLEN])
}
+}
- function _tframe3_i1(A, p, p0, p1, p2)
- {
- if (_TEND[_ARRLEN] in _TEND) {
- return
- }
- if (p in _tNEXT) {
- return (_tframe3_i0(A, p, p0, p1, p2) _tframe3_i1(A, _tNEXT[p], p0, p1, p2))
- }
- return _tframe3_i0(A, p, p0, p1, p2)
+#_______________________________________________
+function _tframe1_i0(A, p, p0)
+{
+ _tframe_link = p
+ while (p in _tLINK) {
+ p = _tLINK[p]
}
-
- function _tframe3_i2(A, m, p, p0, p1, p2)
- {
- _tframe_dlink = p
- while (p in _tDLINK) {
- p = _tDLINK[p]
- }
- if (m in A) {
- if (m "~" in A) {
- if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
- return
- }
- }
- m = A[m]
- return @m(p, p0, p1, p2)
- }
+ if (p in _tFCHLD) {
+ return (_tframe1_i2(A, "^", p, p0) _tframe1_i1(A, _tFCHLD[p], p0))
}
+ return _tframe1_i2(A, ".", p, p0)
+}
- function _tframe4(f, p, p0, p1, p2, p3, A)
- {
- if (_isptr(p)) {
- if (isarray(f)) {
- return _tframe4_i0(f, p, p0, p1, p2, p3)
- }
- _tframex_p0(A, f, 4)
- return _th0(_tframe4_i0(A, p, p0, p1, p2, p3), --_TEND[_ARRLEN])
- }
+#_______________________________________________
+function _tframe1_i1(A, p, p0)
+{
+ if (_TEND[_ARRLEN] in _TEND) {
+ return
}
-
- function _tframe4_i0(A, p, p0, p1, p2, p3)
- {
- _tframe_link = p
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- if (p in _tFCHLD) {
- return (_tframe4_i2(A, "^", p, p0, p1, p2, p3) _tframe4_i1(A, _tFCHLD[p], p0, p1, p2, p3))
- }
- return _tframe4_i2(A, ".", p, p0, p1, p2, p3)
+ if (p in _tNEXT) {
+ return (_tframe1_i0(A, p, p0) _tframe1_i1(A, _tNEXT[p], p0))
}
+ return _tframe1_i0(A, p, p0)
+}
- function _tframe4_i1(A, p, p0, p1, p2, p3)
- {
- if (_TEND[_ARRLEN] in _TEND) {
- return
- }
- if (p in _tNEXT) {
- return (_tframe4_i0(A, p, p0, p1, p2, p3) _tframe4_i1(A, _tNEXT[p], p0, p1, p2, p3))
- }
- return _tframe4_i0(A, p, p0, p1, p2, p3)
+#_______________________________________________
+function _tframe1_i2(A, m, p, p0)
+{
+ _tframe_dlink = p
+ while (p in _tDLINK) {
+ p = _tDLINK[p]
}
-
- function _tframe4_i2(A, m, p, p0, p1, p2, p3)
- {
- _tframe_dlink = p
- while (p in _tDLINK) {
- p = _tDLINK[p]
- }
- if (m in A) {
- if (m "~" in A) {
- if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
- return
- }
+ if (m in A) {
+ if (m "~" in A) {
+ if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
+ return
}
- m = A[m]
- return @m(p, p0, p1, p2, p3)
- }
- }
-
- function _tframe_i0(f, p, p0, p1, p2, a)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
}
- return ((p in _tFCHLD ? _tmframe_i0(f, _tFCHLD[p], p0, p1, p2) : (p in _tDLINK ? @f(_tDLINK[p], p0, p1, p2) : @f(p, p0, p1, p2))))
+ m = A[m]
+ return @m(p, p0)
}
+}
- function _tframe_i1(F, p, p0, p1, p2, a)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
+#_________________________________________________________________
+function _tframe2(f, p, p0, p1, p2, p3, A)
+{
+ #############################
+ if (_isptr(p)) {
+ if (isarray(f)) {
+ return _tframe2_i0(f, p, p0, p1)
}
- return ((p in _tFCHLD ? (("." in F ? _th1(a = F["."], @a(p, p0, p1, p2)) : "")) _tmframe_i1(F, _tFCHLD[p], p0, p1, p2) : (">" in F ? _th1(a = F[">"], (p in _tDLINK ? @a(_tDLINK[p], p0, p1, p2) : @a(p, p0, p1, p2))) : "")))
+ _tframex_p0(A, f, 2)
+ return _th0(_tframe2_i0(A, p, p0, p1), --_TEND[_ARRLEN])
}
+}
- function _tframex(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tframex_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
+#_______________________________________________
+function _tframe2_i0(A, p, p0, p1)
+{
+ _tframe_link = p
+ while (p in _tLINK) {
+ p = _tLINK[p]
}
-
- function _tframex_i0(f, p, p0, p1)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tFCHLD ? _tmframex(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)))
+ if (p in _tFCHLD) {
+ return (_tframe2_i2(A, "^", p, p0, p1) _tframe2_i1(A, _tFCHLD[p], p0, p1))
}
+ return _tframe2_i2(A, ".", p, p0, p1)
+}
- function _tframex_p0(A, f, q, i, B, C)
- {
- _tframe_qparam = q
- delete _TEND[++_TEND[_ARRLEN]]
- if (match(f, /\~(.*)$/, B)) {
- A["^~"] = A[".~"] = B[1]
- f = substr(f, 1, RSTART - 1)
- }
- A["."] = A["^"] = f
+#_______________________________________________
+function _tframe2_i1(A, p, p0, p1)
+{
+ if (_TEND[_ARRLEN] in _TEND) {
return
- q = split(f, B, /;/)
- i = 0
- while (i < q) {
- _tframex_p1(A, C[i])
- while (++i <= q) {
- _tframex_p1(A, C[i], B[i])
- }
- }
}
-
- function _tframex_p1(A, v, i, r, B)
- {
- gsub(/[ \t]+/, "", v)
- while (match(v, /^([^~]*)~\/(([^\/\\]*\\.)*[^\/\\]*)\//, B)) {
- v = B[1] substr(v, RSTART + RLENGTH)
- r = B[2]
- }
- if (i == "") {
- if (v != "") {
- A["."] = v
- delete A["`"]
- delete A["^"]
- }
- if (r != "") {
- A[".~"] = A["`~"] = A["^~"] = r
- }
- } else {
- if (match(v, /!/)) {
- delete A[i]
- } else {
- A[i] = v
- if (r != "") {
- A[i "~"] = r
- }
- }
- }
+ if (p in _tNEXT) {
+ return (_tframe2_i0(A, p, p0, p1) _tframe2_i1(A, _tNEXT[p], p0, p1))
}
+ return _tframe2_i0(A, p, p0, p1)
+}
- function _tgenuid(c)
- {
- for (_uidcntr in _UIDARR1) {
- delete _UIDARR1[_uidcntr]
- for (c in _UIDARR0) {
- _UIDS[_uidcntr c]
- }
- delete _UIDS[_uidcntr c]
- return (_uidcntr c)
- }
- return _fatal("_tUID: Out of UID range")
+#_______________________________________________
+function _tframe2_i2(A, m, p, p0, p1)
+{
+ _tframe_dlink = p
+ while (p in _tDLINK) {
+ p = _tDLINK[p]
}
-
- function _tgenuid_init(a, b, A)
- {
- _ptrlength = 4
- a = "\222\223\224\225\226\227\230\231\232" "\240\241\242\243\244\245\246\247" "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337"
- split(a, A, "")
- for (a in A) {
- for (b in A) {
- _UIDARR0[A[a] A[b]] _UIDARR1[A[a] A[b]]
+ if (m in A) {
+ if (m "~" in A) {
+ if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
+ return
}
}
- _uidcntr = A[a] A[b]
+ m = A[m]
+ return @m(p, p0, p1)
}
+}
- function _tgetitem(p, n, a, b)
- {
- if (p) {
- if (isarray(_PTR[p]["ITEM"]) && n in _PTR[p]["ITEM"]) {
- a = _PTR[p]["ITEM"][n]
- } else {
- a = _PTR[p]["ITEM"][n] = _N()
- }
- if (! (b = _rFCHLD(a))) {
- b = _wLCHLD(a, _N())
- _PTR[b]["HOST"] = p
- _[b]["ITEMNAME"] = n
- }
- return b
+#_________________________________________________________________
+function _tframe3(f, p, p0, p1, p2, p3, A)
+{
+ #############################
+ if (_isptr(p)) {
+ if (isarray(f)) {
+ return _tframe3_i0(f, p, p0, p1, p2)
}
+ _tframex_p0(A, f, 3)
+ return _th0(_tframe3_i0(A, p, p0, p1, p2), --_TEND[_ARRLEN])
}
+}
- function _tgetsp(p)
- {
- return _tSTACK[p][0]
+#_______________________________________________
+function _tframe3_i0(A, p, p0, p1, p2)
+{
+ _tframe_link = p
+ while (p in _tLINK) {
+ p = _tLINK[p]
}
-
- function _th0(p, p1, p2, p3)
- {
- return p
- }
-
- function _th1(p0, p, p2, p3)
- {
- return p
- }
-
- function _th10(p0, p1)
- {
- return (p1 p0)
+ if (p in _tFCHLD) {
+ return (_tframe3_i2(A, "^", p, p0, p1, p2) _tframe3_i1(A, _tFCHLD[p], p0, p1, p2))
}
+ return _tframe3_i2(A, ".", p, p0, p1, p2)
+}
- function _th2(p0, p1, r, p3)
- {
- return p
+#_______________________________________________
+function _tframe3_i1(A, p, p0, p1, p2)
+{
+ if (_TEND[_ARRLEN] in _TEND) {
+ return
}
-
- function _th3(p0, p1, p2, r)
- {
- return p
+ if (p in _tNEXT) {
+ return (_tframe3_i0(A, p, p0, p1, p2) _tframe3_i1(A, _tNEXT[p], p0, p1, p2))
}
+ return _tframe3_i0(A, p, p0, p1, p2)
+}
- function _tifend(l)
- {
- return ((_t_ENDF[0] + l in _t_ENDF ? (_t_ENDF[_t_ENDF[0] + l] ? _t_ENDF[_t_ENDF[0] + l] : 1) : ""))
+#_______________________________________________
+function _tframe3_i2(A, m, p, p0, p1, p2)
+{
+ _tframe_dlink = p
+ while (p in _tDLINK) {
+ p = _tDLINK[p]
}
-
- function _tinit_i0(D, S, i)
- {
- for (i in S) {
- if (isarray(S[i])) {
- if (! isarray(D[i][""])) {
- delete D[i]
- D[i][""]
- delete D[i][""]
- }
- _N_i0(D[i], S[i])
- } else {
- if (isarray(D[i])) {
- delete D[i]
- }
- D[i] = S[i]
+ if (m in A) {
+ if (m "~" in A) {
+ if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
+ return
}
}
+ m = A[m]
+ return @m(p, p0, p1, p2)
}
+}
- function _tlist(L, p, f)
- {
- _tlisti1 = _tlisti0 = L[_ARRLEN] + 0
- if (f == 0 && f == "") {
- _tlist_i0(L, p)
- } else {
- _tlistf0 = (f in _TAPI ? _TAPI[f] : f)
- _tlist_i1(L, p)
+#_________________________________________________________________
+function _tframe4(f, p, p0, p1, p2, p3, A)
+{
+ #############################
+ if (_isptr(p)) {
+ if (isarray(f)) {
+ return _tframe4_i0(f, p, p0, p1, p2, p3)
}
- return (_tlisti0 - _tlisti1)
+ _tframex_p0(A, f, 4)
+ return _th0(_tframe4_i0(A, p, p0, p1, p2, p3), --_TEND[_ARRLEN])
}
+}
- function _tlist_i0(L, p, q, i)
- {
- if (isarray(p)) {
- q = p[_ARRLEN]
- i = 0
- while (i++ < q) {
- _tlist_i0(L, p[i])
- }
- return
- }
- if (p in _) {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- L[++_tlisti0] = p
- if (p in _tFCHLD) {
- for (p = _tFCHLD[p]; p; p = (p in _tNEXT ? _tNEXT[p] : "")) {
- _tlist_i0(L, p)
- }
- }
- }
+#_______________________________________________
+function _tframe4_i0(A, p, p0, p1, p2, p3)
+{
+ _tframe_link = p
+ while (p in _tLINK) {
+ p = _tLINK[p]
}
+ if (p in _tFCHLD) {
+ return (_tframe4_i2(A, "^", p, p0, p1, p2, p3) _tframe4_i1(A, _tFCHLD[p], p0, p1, p2, p3))
+ }
+ return _tframe4_i2(A, ".", p, p0, p1, p2, p3)
+}
- function _tlist_i1(L, p)
- {
- if (isarray(p)) {
- q = p[_ARRLEN]
- i = 0
- while (i++ < q) {
- _tlist_i1(L, p[i])
+#_______________________________________________
+function _tframe4_i1(A, p, p0, p1, p2, p3)
+{
+ if (_TEND[_ARRLEN] in _TEND) {
+ return
+ }
+ if (p in _tNEXT) {
+ return (_tframe4_i0(A, p, p0, p1, p2, p3) _tframe4_i1(A, _tNEXT[p], p0, p1, p2, p3))
+ }
+ return _tframe4_i0(A, p, p0, p1, p2, p3)
+}
+
+#_______________________________________________
+function _tframe4_i2(A, m, p, p0, p1, p2, p3)
+{
+ _tframe_dlink = p
+ while (p in _tDLINK) {
+ p = _tDLINK[p]
+ }
+ if (m in A) {
+ if (m "~" in A) {
+ if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) {
+ return
}
- return
}
- if (p in _) {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- if (_tlistf0 in _[p]) {
- L[++_tlisti0] = p
+ m = A[m]
+ return @m(p, p0, p1, p2, p3)
+ }
+}
+
+#___________________________________________________________
+function _tframe_i0(f, p, p0, p1, p2, a)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tFCHLD ? _tmframe_i0(f, _tFCHLD[p], p0, p1, p2) : (p in _tDLINK ? @f(_tDLINK[p], p0, p1, p2) : @f(p, p0, p1, p2))))
+}
+
+#___________________________________________________________
+function _tframe_i1(F, p, p0, p1, p2, a)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tFCHLD ? (("." in F ? _th1(a = F["."], @a(p, p0, p1, p2)) : "")) _tmframe_i1(F, _tFCHLD[p], p0, p1, p2) : (">" in F ? _th1(a = F[">"], (p in _tDLINK ? @a(_tDLINK[p], p0, p1, p2) : @a(p, p0, p1, p2))) : "")))
+}
+
+#_______________________________________________________________________
+function _tframex(f, p, p0, p1)
+{
+ ############################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tframex_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tframex_i0(f, p, p0, p1)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tFCHLD ? _tmframex(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_____________________________________________________
+function _tframex_p0(A, f, q, i, B, C)
+{
+ _tframe_qparam = q
+ delete _TEND[++_TEND[_ARRLEN]]
+ if (match(f, /\~(.*)$/, B)) {
+ A["^~"] = A[".~"] = B[1]
+ f = substr(f, 1, RSTART - 1)
+ }
+ A["."] = A["^"] = f
+ return
+ q = split(f, B, /;/)
+ i = 0
+ while (i < q) {
+ _tframex_p1(A, C[i])
+ while (++i <= q) {
+ _tframex_p1(A, C[i], B[i])
+ }
+ }
+}
+
+#_______________________________________________
+function _tframex_p1(A, v, i, r, B)
+{
+ gsub(/[ \t]+/, "", v)
+ while (match(v, /^([^~]*)~\/(([^\/\\]*\\.)*[^\/\\]*)\//, B)) {
+ v = B[1] substr(v, RSTART + RLENGTH)
+ r = B[2]
+ }
+ if (i == "") {
+ if (v != "") {
+ A["."] = v
+ delete A["`"]
+ delete A["^"]
+ }
+ if (r != "") {
+ A[".~"] = A["`~"] = A["^~"] = r
+ }
+ } else {
+ if (match(v, /!/)) {
+ delete A[i]
+ } else {
+ A[i] = v
+ if (r != "") {
+ A[i "~"] = r
+ }
+ }
+ }
+}
+
+#_____________________________________________________
+# F v action
+#-----------------------------------------------------
+# - * no additional action
+# A B delete A[p] and define A[p] as array; copy array B to array A[p]
+# A - delete A[p]
+# A "*" delete A[p]; A[p]="*"
+# "*" B define _[p]["*"] as array; copy array B to array _[p]["*"]
+# "*" - run _mpu program "*" for `p
+# "*0" "*1" _[p]["*0"]="*1"
+#___________________________________________________________
+function _tgenuid(c)
+{
+ for (_uidcntr in _UIDARR1) {
+ delete _UIDARR1[_uidcntr]
+ for (c in _UIDARR0) {
+ _UIDS[_uidcntr c]
+ }
+ delete _UIDS[_uidcntr c]
+ return (_uidcntr c)
+ }
+ return _fatal("_tUID: Out of UID range")
+}
+
+#_____________________________________________________
+function _tgenuid_init(a, b, A)
+{
+ _ptrlength = 4
+ a = "\222\223\224\225\226\227\230\231\232" "\240\241\242\243\244\245\246\247" "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277" "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317" "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337"
+ split(a, A, "")
+ for (a in A) {
+ for (b in A) {
+ _UIDARR0[A[a] A[b]] _UIDARR1[A[a] A[b]]
+ }
+ }
+ _uidcntr = A[a] A[b]
+}
+
+# if ( F in _TCLASS ) { _[p]["CLASS"]=_TCLASS[F]; _tapi(p); return p }
+# # ??? _mpu(F,p) ???
+# return p }
+# _[p][F]=v; return p }
+
+#_______________________________________________________________________
+function _tgetitem(p, n, a, b)
+{
+ ############################################
+ if (p) {
+ if (isarray(_PTR[p]["ITEM"]) && n in _PTR[p]["ITEM"]) {
+ a = _PTR[p]["ITEM"][n]
+ } else {
+ a = _PTR[p]["ITEM"][n] = _N()
+ }
+ if (! (b = _rFCHLD(a))) {
+ b = _wLCHLD(a, _N())
+ _PTR[b]["HOST"] = p
+ _[b]["ITEMNAME"] = n
+ }
+ return b
+ }
+}
+
+#_________________________________________________________________
+function _tgetsp(p)
+{
+ ###############################################
+ return _tSTACK[p][0]
+}
+
+####################################################################################
+
+#_____________________________________________________________________________
+function _th0(p, p1, p2, p3)
+{
+ return p
+}
+
+##########################################
+#_________________________________________________________________
+function _th1(p0, p, p2, p3)
+{
+ return p
+}
+
+##############################
+#_________________________________________________________________
+function _th10(p0, p1)
+{
+ return (p1 p0)
+}
+
+##############################
+#_________________________________________________________________
+function _th2(p0, p1, r, p3)
+{
+ return p
+}
+
+##############################
+#_________________________________________________________________
+function _th3(p0, p1, p2, r)
+{
+ return p
+}
+
+#_________________________________________________________________
+function _tifend(l)
+{
+ ###############################################
+ return ((_t_ENDF[0] + l in _t_ENDF ? (_t_ENDF[_t_ENDF[0] + l] ? _t_ENDF[_t_ENDF[0] + l] : 1) : ""))
+}
+
+# test _tbrochld fn; develope tOBJ r\w func specification for brochld func
+
+#_________________________________________________________________
+function _tinit_i0(D, S, i)
+{
+ for (i in S) {
+ if (isarray(S[i])) {
+ if (! isarray(D[i][""])) {
+ delete D[i]
+ D[i][""]
+ delete D[i][""]
}
- if (p in _tFCHLD) {
- for (p = _tFCHLD[p]; p; p = (p in _tNEXT ? _tNEXT[p] : "")) {
- _tlist_i1(L, p)
- }
+ _N_i0(D[i], S[i])
+ } else {
+ if (isarray(D[i])) {
+ delete D[i]
}
+ D[i] = S[i]
}
}
+}
- function _tmbframe(f, p, p0, p1, t)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- t = t _tbframe_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : ""))
- }
- return t
- }
+#_______________________________________________________________________
+########################################################################
- function _tmbframex(f, p, p0, p1, t)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- t = t _tbframex_i0(f, p, p0, p1)
- p = (p in _tPREV ? _tPREV[p] : "")
- }
- return t
- }
- function _tmbpass(f, p, p0, p1)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : ""))
- }
- return p0
- }
- function _tmbpassx(f, p, p0, p1)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- p0 = _tbpassx_i0(f, p, p0, p1)
- p = (p in _tPREV ? _tPREV[p] : "")
- }
- return p0
- }
- function _tmframe(f, p, p0, p1, p2)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tmframe_i0(f, p, p0, p1, p2) : "")
- --_t_ENDF[0]
- return f
- }
- function _tmframe_i0(f, p, p0, p1, p2, t)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- t = t _tframe_i0(f, p, p0, p1, p2, p = (p in _tNEXT ? _tNEXT[p] : ""))
- }
- return t
- }
- function _tmframe_i1(F, p, p0, p1, p2, t)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- t = t _tframe_i1(F, p, p0, p1, p2, p = (p in _tNEXT ? _tNEXT[p] : ""))
- }
- return t
- }
- function _tmframex(f, p, p0, p1, t)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- t = t _tframex_i0(f, p, p0, p1)
- p = (p in _tNEXT ? _tNEXT[p] : "")
- }
- return t
- }
- function _tmpass(f, p, p0, p1)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tNEXT ? _tNEXT[p] : ""))
- }
- return p0
- }
- function _tmpassx(f, p, p0, p1)
- {
- while (p && ! (_t_ENDF[0] in _t_ENDF)) {
- p0 = _tbpassx_i0(f, p, p0, p1)
- p = (p in _tNEXT ? _tNEXT[p] : "")
- }
- return p0
- }
- function _torexp(r)
- {
- return _subseqon(_TOREXPB0, gensub(/(^[ \t]+)|(([ \t]*(\\)+)+[ \t]*)|([ \t]+$)/, "\\4", "G", _subseqoff(r, _TOREXPB0)), _TOREXPFN)
- }
- function _torexp_cmdstr(t)
- {
- return _strtorexp(gensub(/\^(.)/, "\\1", "G", t))
- }
- function _torexp_fmask(t)
- {
- return gensub(/\\\*/, ".*", "G", gensub(/\\\?/, ".?", "G", _strtorexp(t)))
- }
- function _torexp_init()
- {
- _TOREXPFN[""] = "_strtorexp"
- _TOREXPFN["~"] = "_torexp_rexp"
- _TOREXPFN["="] = "_strtorexp"
- _TOREXPFN[">"] = "_torexp_cmdstr"
- _TOREXPFN["#"] = "_torexp_fmask"
- _TOREXPFN["\""] = "_torexp_dqstr"
- _TOREXPFN["'"] = "_torexp_sqstr"
- }
- function _torexp_rexp(t)
- {
- return t
- }
- function _tpass(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tpass_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
- }
- function _tpass_i0(f, p, p0, p1, a)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tFCHLD ? _tmpass(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)))
- }
- function _tpassx(f, p, p0, p1)
- {
- delete _t_ENDF[++_t_ENDF[0]]
- f = (p ? _tpassx_i0(f, p, p0, p1) : "")
- --_t_ENDF[0]
- return f
- }
- function _tpassx_i0(f, p, p0, p1)
- {
- while (p in _tLINK) {
- p = _tLINK[p]
- }
- return ((p in _tFCHLD ? _tmpassx(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)))
- }
- function _tpop(p, aA, a)
- {
- if ((a = _tSTACK[p][0]) > 0) {
- _tSTACK[p][0]--
- if (isarray(_tSTACK[p][a])) {
- delete aA
- _movarr(aA, _tSTACK[p][a])
- return
- }
- return _tSTACK[p][a]
- }
- _fatal("^" p ": Out of tSTACK")
- }
- function _tpush(p, aA, a)
- {
- if (isarray(aA)) {
- delete _tSTACK[p][a = ++_tSTACK[p][0]]
- _tSTACK[p][a][""]
- delete _tSTACK[p][a][""]
- _movarr(_tSTACK[p][a], aA)
- return
- }
- delete _tSTACK[p][a = ++_tSTACK[p][0]]
- return (_tSTACK[p][a] = aA)
- }
-
- function _tr(n, cs, H)
- {
- _rconline(n ": " cs)
- _rconl()
- if (match(cs, /^((([^\xB4:\[\|\]]*\xB4.)*[^\xB4:\[\|\]]*):)?((([^\xB4\[\|\]]*\xB4.)*[^\xB4\[\|\]]*)\[)?(([^\xB4\|\]]*\xB4.)*[^\xB4\|\]]*)?(\|(\.)?(([^\xB4\]]*\xB4.)*[^\xB4\]]*))?(\](.*))?$/, H)) {
- _rconl("delptr: " _une(H[2]) "'")
- _rconl("pfxstr: " _une(H[5]) "'")
- _rconl("hichr: " _une(H[7]) "'")
- _rconl("lochr: " _une((H[10] ? H[7] "' and " H[11] "'" : H[11] "'")))
- _rconl("sfxstr: " _une(H[14]) "'")
- } else {
- _rconl("NOT MATCH!")
- }
- _rconl()
- }
- function _trace(t, d, A)
- {
- if (_ERRLOG_TF) {
- A["TYPE"] = "TRACE"
- A["TEXT"] = t
- _log(A, d)
- }
- }
- function _trunframe(f, p, p0, p1, p2)
- {
- return _tframe((f ? f : "_trunframe_i0"), p, p0, p1, p2)
- }
+#_______________________________________________________________________
+# _N(arr\str\mpuptr,val) \ _n(arr\str\mpuptr,val)
+# This functions create new object and return ptr.
+# _n() - creates object from list of deleted objects or if it's empty create new one, while _N() always create new one
+# It is strongly recommended to use _N() for the objects that have some data outside of standart object arrays. Or - make routines
+# that will clear outsided object data in case if object deleting.
+#
+# IN: arr\str\mpu,val - (both missed) just create obj and return ptr
+# arr,val - create object and write arr[ptr]=val
+# str,val - create object and write _[ptr][str]=val
+# mpuptr - NOT ALLOWED (val missed) create object and run MPU-code specified by mpuptr with created object ptr as primary parameter
+# MOD: -
+# OUT: -
+# RETURN: ptr - pointer to newly created object
+#_________________________________________________________________
+# _tdel(ptr)
+# This function exclude object from it's current structure and delete it. ptr can be later used by function: _n() for creating new object
+# Also same story will occured with all chields and subchields of object specified by ptr.
+# ??? What happened with linked py _ptr[ptr] objects ???
+#
+# IN: ptr - pointer to object that will deleted
+# MOD: -
+# OUT: -
+# RETURN: undefined
+#_________________________________________________________________
+# _isptr(ptr)
+# This function checks: is ptr is the object pointer that is currently exist?
+# Unescaped remained data will be in data of src_dst_ptr.
+#
+# IN: ptr - string that will be tested
+# MOD: -
+# OUT: -
+# RETURN: undefined - if ptr is not pointer to exist object
+# ptr - if ptr is the pointer to exist object
+#_________________________________________________________________
- function _trunframe_i0(p, p0, p1, p2, f)
- {
- if (p in _tFN) {
- f = _tFN[p]
- return @f(p, p0, p1, p2)
- }
- }
- function _trunframex(f, p, p0, p1)
- {
- return _tframex((f ? f : "_trunframe_i0"), p, p0, p1)
- }
- function _trunpass(f, p, p0, p1)
- {
- return _tpass((f ? f : "_trunframe_i0"), p, p0, p1)
- }
+#_________________________________________________________________
+#
+# TO DESIGN:
+#
+# create basic objectapi interface support
+# modify everywhere checking ptr not by `if ( ptr )...', but by `if ( ptr in _ )...'
+# _TMP0, _TMP1 name change to something like _DATA name ???
+# think about redesigning routines for not depending if ptr is exist in tsysarrs: reason: performance\light code
- function _trunpassx(f, p, p0, p1)
- {
- return _tpassx((f ? f : "_trunframe_i0"), p, p0, p1)
- }
- function _tsetsp(p, v)
- {
- return (_tSTACK[p][0] = v)
- }
- function _tstini()
- {
- _ini("uidel:pfx'hstr|lstr'sfx")
- _ini("uidel:pfx'hstr|lstr'")
- _ini("uidel:'hstr|lstr'sfx")
- _ini("uidel:'hstr|lstr'")
- _ini("uidel:pfx'hstr'sfx")
- _ini("uidel:pfx'hstr'")
- _ini("uidel:'hstr'sfx")
- _ini("uidel:'hstr'")
- _conl()
- _conl("########################################################################################")
- _conl()
- _ini("pfx'hstr|lstr'sfx")
- _ini("pfx'hstr|lstr'")
- _ini("'hstr|lstr'sfx")
- _ini("'hstr|lstr'")
- _ini("pfx'hstr'sfx")
- _ini("pfx'hstr'")
- _ini("'hstr'sfx")
- _ini("'hstr'")
- _conl()
- _conl("########################################################################################")
- _conl()
- _ini("uidel:pfx'`cntptr'sfx")
- _ini("uidel:pfx'`cntptr'")
- _ini("uidel:'`cntptr'sfx")
- _ini("uidel:'`cntptr'")
- _conl()
- _conl("########################################################################################")
- _conl()
- _ini("pfx'`cntptr'sfx")
- _ini("pfx'`cntptr'")
- _ini("'`cntptr'sfx")
- _ini("'`cntptr'")
- _conl()
- _conl("########################################################################################")
- _conl()
- _ini("uidel:pfx'^chrptr'sfx")
- _ini("uidel:pfx'^chrptr'")
- _ini("uidel:'^chrptr'sfx")
- _ini("uidel:'^chrptr'")
- _conl()
- _conl("########################################################################################")
- _conl()
- _ini("pfx'^chrptr'sfx")
- _ini("pfx'^chrptr'")
- _ini("'^chrptr'sfx")
- _ini("'^chrptr'")
- _conl()
- _conl("########################################################################################")
- _conl()
- }
- function _tstv(p, A, r, f)
- {
- if (f == "") {
- f = "tst_splitstr"
- }
- @f(_NOP, A, p)
- @f(AA0, A, p)
- @f(AB0, A, p)
- @f(AC0, A, p)
- @f("", A, p)
- @f("a", A, p)
- @f("\264a", A, p)
- @f("\264", A, p)
- @f("a\264\264\264,ba\264\264\264,", A, p)
- @f("\264,", A, p)
- @f(",", A, p)
- @f("\264a,", A, p)
- @f("ab,", A, p)
- @f("ab,\264", A, p)
- @f("\264a\264,,ba", A, p)
- @f(",a,,b\264,c,,\264a,,\264,,,", A, p)
- }
- function _typ(p)
- {
- return (_t0 = (isarray(p) ? "#" : (p == 0 ? (p == "" ? 0 : (p in _CLASSPTR ? "`" : (p ? 3 : 4))) : (p in _CLASSPTR ? "`" : (p + 0 == p ? 5 : (p ? 3 : 2))))))
- }
- function _typa(p, A)
- {
- return (_t0 = (isarray(p) ? "#" : (p == 0 ? (p == "" ? 0 : (p in A ? "`" : (p ? 3 : 4))) : (p in A ? "`" : (p + 0 == p ? 5 : (p ? 3 : 2))))))
- }
- function _tzend(a, b)
- {
- if (b == 0 && b == "") {
- return (_TEND[_TEND[_ARRLEN]] = a)
- } else {
- return (_TEND[_TEND[_ARRLEN] + a] = b)
- }
- }
- function _uidcyc(p, i)
- {
- _dumpuidgen(p)
- for (i = 1; i < 64 * 8 * 6 - 1; i++) {
- _conl(i ":" _var(_getuid(p)))
- }
- _dumpuidgen(p)
- }
- function _une(t)
- {
- return gensub(/\xB4(.)/, "\\1", "G", t)
- }
- function _unformatrexp(t)
- {
- _formatstrq0 = split(t, _FORMATSTRA, /(\\[0-9]{1,3})|(\\x[[:xdigit:]]+)|(\\.)/, _FORMATSTRB)
- _formatstrs0 = ""
- for (t = 1; t < _formatstrq0; t++) {
- _formatstrs0 = _formatstrs0 _FORMATSTRA[t] ((_FORMATSTRB[t] in _QESCHR ? _QESCREXP[_FORMATSTRB[t]] : _QESCREXP[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))]))
- }
- return (_formatstrs0 _FORMATSTRA[t])
- }
- function _unformatrexp_init(i, a)
- {
- _formatstrs0 = "\\^$.[]|()*+?{}-sSwW<>yB`'"
- delete _FORMATSTRB
- for (i = 0; i < 256; i++) {
- _QESCREXP["\\" _CHR[i]] = (index(_formatstrs0, _CHR[i]) ? "\\" _CHR[i] : _CHR[i])
- }
- for (i = 0; i < 256; i++) {
- a = (index(_formatstrs0, _CHR[i]) ? "\\" : "")
- _QESCREXP[sprintf("%.2X", i)] = a _CHR[i]
- _QESCREXP["\\" sprintf("%.3o", i)] = a _CHR[i]
- if (i < 8) {
- _QESCREXP["\\" sprintf("%.1o", i)] = a _CHR[i]
- }
- if (i < 64) {
- _QESCREXP["\\" sprintf("%.2o", i)] = a _CHR[i]
- }
- if (i < 16) {
- _QESCREXP["\\x" sprintf("%.1X", i)] = _QESCREXP["\\x" sprintf("%.1x", i)] = a _CHR[i]
- }
- }
- patsplit("a" 7 "b" 8 "f" 12 "n" 10 "r" 13 "t" 9 "v" 11, _FORMATSTRA, /[^0-9]/, _FORMATSTRB)
- for (i in _FORMATSTRA) {
- _QESCREXP["\\" _FORMATSTRA[i]] = _CHR[_FORMATSTRB[i] + 0]
- }
+function _tlist(L, p, f)
+{
+ _tlisti1 = _tlisti0 = L[_ARRLEN] + 0
+ if (f == 0 && f == "") {
+ _tlist_i0(L, p)
+ } else {
+ _tlistf0 = (f in _TAPI ? _TAPI[f] : f)
+ _tlist_i1(L, p)
}
+ return (_tlisti0 - _tlisti1)
+}
- function _unformatstr(t)
- {
- _formatstrq0 = split(t, _FORMATSTRA, /(\\[0-9]{1,3})|(\\x[[:xdigit:]]+)|(\\.)/, _FORMATSTRB)
- _formatstrs0 = ""
- for (t = 1; t < _formatstrq0; t++) {
- _formatstrs0 = _formatstrs0 _FORMATSTRA[t] ((_FORMATSTRB[t] in _QESCHR ? _QESCHR[_FORMATSTRB[t]] : _QESCHR[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))]))
+function _tlist_i0(L, p, q, i)
+{
+ if (isarray(p)) {
+ q = p[_ARRLEN]
+ i = 0
+ while (i++ < q) {
+ _tlist_i0(L, p[i])
}
- return (_formatstrs0 _FORMATSTRA[t])
+ return
}
-
- function _unformatstr_init(i)
- {
- for (i = 0; i < 256; i++) {
- _QESCHR["\\" _CHR[i]] = _CHR[i]
- }
- for (i = 0; i < 256; i++) {
- _QESCHR[sprintf("%.2X", i)] = _CHR[i]
- _QESCHR["\\" sprintf("%.3o", i)] = _CHR[i]
- if (i < 8) {
- _QESCHR["\\" sprintf("%.1o", i)] = _CHR[i]
- }
- if (i < 64) {
- _QESCHR["\\" sprintf("%.2o", i)] = _CHR[i]
- }
- if (i < 16) {
- _QESCHR["\\x" sprintf("%.1X", i)] = _QESCHR["\\x" sprintf("%.1x", i)] = _CHR[i]
- }
- }
- i = "a" 7 "b" 8 "f" 12 "n" 10 "r" 13 "t" 9 "v" 11
- patsplit(i, _FORMATSTRA, /[^0-9]/, _FORMATSTRB)
- for (i in _FORMATSTRA) {
- _QESCHR["\\" _FORMATSTRA[i]] = _CHR[_FORMATSTRB[i] + 0]
+ if (p in _) {
+ while (p in _tLINK) {
+ p = _tLINK[p]
}
- }
-
- function _uninit_del(A, i, p0)
- {
- _del(i)
- }
-
- function _unstr(t)
- {
- return gensub(/\\(.)/, "\\1", "G", t)
- }
-
- function _untmp(f, a)
- {
- if (f = filepath(f)) {
- if (match(f, /\\$/)) {
- _deletepfx(_FILEIO_RDTMP, a = toupper(f))
- _deletepfx(_FILEIO_RDNETMP, a)
- } else {
- delete _FILEIO_RDNETMP[toupper(f)]
+ L[++_tlisti0] = p
+ if (p in _tFCHLD) {
+ for (p = _tFCHLD[p]; p; p = (p in _tNEXT ? _tNEXT[p] : "")) {
+ _tlist_i0(L, p)
}
- return f
}
- return ""
}
+}
- function _val(v, t)
- {
- if (isarray(v)) {
- return (_dumparr(v) _ln(t))
- }
- if (v == 0 && v == "") {
- return (_ln("- (ERRNO=" ERRNO ")") _ln(t))
+function _tlist_i1(L, p)
+{
+ if (isarray(p)) {
+ q = p[_ARRLEN]
+ i = 0
+ while (i++ < q) {
+ _tlist_i1(L, p[i])
}
- return (_ln(v "'") _ln(t))
+ return
}
-
- function _val0(v)
- {
- if (isarray(v)) {
- return _dumparr(v)
- }
- if (v == 0 && v == "") {
- return "-"
+ if (p in _) {
+ while (p in _tLINK) {
+ p = _tLINK[p]
}
- return ("\"" v "\"")
- }
-
- function _var(v, t)
- {
- if (isarray(v)) {
- return (_dumparr(v) _ln(t))
+ if (_tlistf0 in _[p]) {
+ L[++_tlisti0] = p
}
- if (v == 0 && v == "") {
- return (_ln("- (ERRNO=" ERRNO ")") _ln(t))
+ if (p in _tFCHLD) {
+ for (p = _tFCHLD[p]; p; p = (p in _tNEXT ? _tNEXT[p] : "")) {
+ _tlist_i1(L, p)
+ }
+ }
+ }
+}
+
+#_________________________________________________________________
+function _tmbframe(f, p, p0, p1, t)
+{
+ ##################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ t = t _tbframe_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : ""))
+ }
+ return t
+}
+
+#_________________________________________________________________
+function _tmbframex(f, p, p0, p1, t)
+{
+ #################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ t = t _tbframex_i0(f, p, p0, p1)
+ p = (p in _tPREV ? _tPREV[p] : "")
+ }
+ return t
+}
+
+#_________________________________________________________________
+function _tmbpass(f, p, p0, p1)
+{
+ ######################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : ""))
+ }
+ return p0
+}
+
+#_________________________________________________________________
+function _tmbpassx(f, p, p0, p1)
+{
+ #####################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ p0 = _tbpassx_i0(f, p, p0, p1)
+ p = (p in _tPREV ? _tPREV[p] : "")
+ }
+ return p0
+}
+
+#_________________________________________________________________
+function _tmframe(f, p, p0, p1, p2)
+{
+ ###################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tmframe_i0(f, p, p0, p1, p2) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tmframe_i0(f, p, p0, p1, p2, t)
+{
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ t = t _tframe_i0(f, p, p0, p1, p2, p = (p in _tNEXT ? _tNEXT[p] : ""))
+ }
+ return t
+}
+
+#___________________________________________________________
+function _tmframe_i1(F, p, p0, p1, p2, t)
+{
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ t = t _tframe_i1(F, p, p0, p1, p2, p = (p in _tNEXT ? _tNEXT[p] : ""))
+ }
+ return t
+}
+
+#_________________________________________________________________
+function _tmframex(f, p, p0, p1, t)
+{
+ ##################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ t = t _tframex_i0(f, p, p0, p1)
+ p = (p in _tNEXT ? _tNEXT[p] : "")
+ }
+ return t
+}
+
+#_________________________________________________________________
+function _tmpass(f, p, p0, p1)
+{
+ #######################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tNEXT ? _tNEXT[p] : ""))
+ }
+ return p0
+}
+
+#_________________________________________________________________
+function _tmpassx(f, p, p0, p1)
+{
+ ######################################
+ while (p && ! (_t_ENDF[0] in _t_ENDF)) {
+ p0 = _tbpassx_i0(f, p, p0, p1)
+ p = (p in _tNEXT ? _tNEXT[p] : "")
+ }
+ return p0
+}
+
+function _torexp(r)
+{
+ return _subseqon(_TOREXPB0, gensub(/(^[ \t]+)|(([ \t]*(\\)+)+[ \t]*)|([ \t]+$)/, "\\4", "G", _subseqoff(r, _TOREXPB0)), _TOREXPFN)
+}
+
+function _torexp_cmdstr(t)
+{
+ return _strtorexp(gensub(/\^(.)/, "\\1", "G", t))
+}
+
+function _torexp_fmask(t)
+{
+ return gensub(/\\\*/, ".*", "G", gensub(/\\\?/, ".?", "G", _strtorexp(t)))
+}
+
+#_______________________________________________
+function _torexp_init()
+{
+ _TOREXPFN[""] = "_strtorexp"
+ _TOREXPFN["~"] = "_torexp_rexp"
+ _TOREXPFN["="] = "_strtorexp"
+ _TOREXPFN[">"] = "_torexp_cmdstr"
+ _TOREXPFN["#"] = "_torexp_fmask"
+ _TOREXPFN["\""] = "_torexp_dqstr"
+ _TOREXPFN["'"] = "_torexp_sqstr"
+}
+
+#_______________________________________________
+function _torexp_rexp(t)
+{
+ return t
+}
+
+#_____________________________________________________________________________
+function _tpass(f, p, p0, p1)
+{
+ ####################################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tpass_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tpass_i0(f, p, p0, p1, a)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tFCHLD ? _tmpass(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_____________________________________________________________________________
+function _tpassx(f, p, p0, p1)
+{
+ ###################################################
+ delete _t_ENDF[++_t_ENDF[0]]
+ f = (p ? _tpassx_i0(f, p, p0, p1) : "")
+ --_t_ENDF[0]
+ return f
+}
+
+#___________________________________________________________
+function _tpassx_i0(f, p, p0, p1)
+{
+ while (p in _tLINK) {
+ p = _tLINK[p]
+ }
+ return ((p in _tFCHLD ? _tmpassx(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)))
+}
+
+#_________________________________________________________________
+function _tpop(p, aA, a)
+{
+ ###########################################
+ if ((a = _tSTACK[p][0]) > 0) {
+ _tSTACK[p][0]--
+ if (isarray(_tSTACK[p][a])) {
+ delete aA
+ _movarr(aA, _tSTACK[p][a])
+ return
}
- return (_ln(v "'") _ln(t))
+ return _tSTACK[p][a]
}
+ _fatal("^" p ": Out of tSTACK")
+}
- function _verb(t, d, A)
- {
- if (_ERRLOG_VF) {
- A["TYPE"] = "VERB"
- A["TEXT"] = t
- _log(A, d)
- }
+#_____________________________________________________________________________
+function _tpush(p, aA, a)
+{
+ ######################################################
+ if (isarray(aA)) {
+ delete _tSTACK[p][a = ++_tSTACK[p][0]]
+ _tSTACK[p][a][""]
+ delete _tSTACK[p][a][""]
+ _movarr(_tSTACK[p][a], aA)
+ return
}
-
- function _wFBRO(p, v, a)
- {
- if (p) {
- if (v) {
- for (a = p; a in _tPARENT; ) {
- if ((a = _tPARENT[a]) == v) {
- return v
- }
- }
- if (p in _tPARENT) {
- p = _tPARENT[p]
- if (v in _tNEXT) {
- if (v in _tPREV) {
- _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
- delete _tPREV[v]
- if (v in _tPARENT) {
- if (p == (a = _tPARENT[v])) {
- return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[p]] = v)
- }
- --_tQCHLD[a]
- }
- } else {
- if (v in _tPARENT) {
- if (p == (a = _tPARENT[v])) {
- return v
- }
- delete _tPREV[_tFCHLD[a] = _tNEXT[v]]
- --_tQCHLD[a]
- } else {
- delete _tPREV[_tNEXT[v]]
- }
- }
- ++_tQCHLD[p]
- return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
- } else {
- if (v in _tPREV) {
- if (v in _tPARENT) {
- delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]]
- if (p == a) {
- delete _tPREV[v]
- return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[p]] = v)
- }
- --_tQCHLD[a]
- } else {
- delete _tNEXT[_tPREV[v]]
- }
- delete _tPREV[v]
- } else {
- if (v in _tPARENT) {
- if (p == (a = _tPARENT[v])) {
- return v
- }
- delete _tFCHLD[a]
- delete _tLCHLD[a]
- delete _tQCHLD[a]
- }
- }
- ++_tQCHLD[p]
- return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
- }
- } else {
- while (p in _tPREV) {
- p = _tPREV[p]
- }
- if (v in _tPREV) {
- if (v in _tPARENT) {
- --_tQCHLD[a = _tPARENT[v]]
- delete _tPARENT[v]
- if (v in _tNEXT) {
- _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
- } else {
- delete _tNEXT[_tLCHLD[a] = _tPREV[v]]
- }
- } else {
- if (v in _tNEXT) {
- _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
- } else {
- delete _tNEXT[_tPREV[v]]
- }
- }
- delete _tPREV[v]
- } else {
- if (p == v) {
- return v
- }
- if (v in _tPARENT) {
- if (v in _tNEXT) {
- delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]]
- --_tQCHLD[a]
- } else {
- delete _tLCHLD[a = _tPARENT[v]]
- delete _tFCHLD[a]
- delete _tQCHLD[a]
- }
- delete _tPARENT[v]
- } else {
- if (v in _tNEXT) {
- delete _tPREV[_tNEXT[v]]
- }
- }
- }
- return (_tPREV[_tNEXT[v] = p] = v)
- }
- } else {
- if (v == 0) {
- return v
- }
- return v
- }
+ delete _tSTACK[p][a = ++_tSTACK[p][0]]
+ return (_tSTACK[p][a] = aA)
+}
+
+# prefix -
+# prichr - aware character `{', `^',`]'
+# sechr - aware character `.' as the first char of sechr, and character `}'
+# suffix - aware character `]'
+# cntptr - aware character `]'
+
+function _tr(n, cs, H)
+{
+ #_tuidinitcs[p]=cs
+ #2 uidel, 5 pfx, 7 hichr,11(10) lochr,14 suffix
+ _rconline(n ": " cs)
+ _rconl()
+ if (match(cs, /^((([^\xB4:\[\|\]]*\xB4.)*[^\xB4:\[\|\]]*):)?((([^\xB4\[\|\]]*\xB4.)*[^\xB4\[\|\]]*)\[)?(([^\xB4\|\]]*\xB4.)*[^\xB4\|\]]*)?(\|(\.)?(([^\xB4\]]*\xB4.)*[^\xB4\]]*))?(\](.*))?$/, H)) {
+ _rconl("delptr: " _une(H[2]) "'")
+ _rconl("pfxstr: " _une(H[5]) "'")
+ _rconl("hichr: " _une(H[7]) "'")
+ _rconl("lochr: " _une((H[10] ? H[7] "' and " H[11] "'" : H[11] "'")))
+ _rconl("sfxstr: " _une(H[14]) "'")
+ } else {
+ _rconl("NOT MATCH!")
+ }
+ _rconl()
+}
+
+#_______________________________________________________________________
+function _trace(t, d, A)
+{
+ #################################################
+ if (_ERRLOG_TF) {
+ A["TYPE"] = "TRACE"
+ A["TEXT"] = t
+ _log(A, d)
+ }
+}
+
+#_________________________________________________________________
+function _trunframe(f, p, p0, p1, p2)
+{
+ #################################
+ return _tframe((f ? f : "_trunframe_i0"), p, p0, p1, p2)
+}
+
+#_________________________________________________________________
+function _trunframe_i0(p, p0, p1, p2, f)
+{
+ if (p in _tFN) {
+ f = _tFN[p]
+ return @f(p, p0, p1, p2)
+ }
+}
+
+#_________________________________________________________________
+function _trunframex(f, p, p0, p1)
+{
+ ###################################
+ return _tframex((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_________________________________________________________________
+function _trunpass(f, p, p0, p1)
+{
+ #####################################
+ return _tpass((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_________________________________________________________________
+function _trunpassx(f, p, p0, p1)
+{
+ ####################################
+ return _tpassx((f ? f : "_trunframe_i0"), p, p0, p1)
+}
+
+#_________________________________________________________________
+function _tsetsp(p, v)
+{
+ #############################################
+ return (_tSTACK[p][0] = v)
+}
+
+# dptr - morg ptr; in case if object deleted then _CLASSPTR[ptr] will be deleted(object is death), but
+# _tUIDEL[_CLASSPTR[ptr]] will be created that object can be resurrected from morg
+# dptr can be any string containing any characters except `:'. It's not verified
+# pfx,sfx - uid prefix str, and uid suffix str; this strings specifies string that can be inserted before/after
+# uid generated by uid generator:
+#
+# class uid: pfx uidgen sfx
+#
+# Both can be any string(including ""), and can contains any character with B4-escaping feature.
+# Note: that this strings cannot contains "'" character: it's should be escaped by B4-escaper.
+# hstr,lstr - this values configure uid-generator itself. ther is a 3 combinations regarding its:
+#
+# hstr lstr function
+#
+# `ptr * - specify pointer to external uid-generator
+# All uids and chars will be generated by external uid-generator
+# * ^ptr - class will have it's own uid generator using external character set
+# str str - class will have it's own uid generator with it's own character set
+# character set inmplemented in hstr(high-charset) and in lstr(low-charset) in 2 ways:
+# 1) "AB" "AB01" - this mean that high-charset contain chars: `A' and `B'
+# low-charset contains chars: `A', `B', `0', `1'
+#
+# 2) "Az,By" "Ax,Bw,0v,1u" - this mean that high-charset contain chars: `Az' and `By'
+# low-charset contains chars: `Ax', `Bw', `0v', `1u'
+# Note: both: hstr and lstr cannot contain char `,' directly, but it's can uses
+# B4-escaper to escape any char including `,'
+
+
+
+# !!!! in case of using `,' in hstr/lstr - the escaped `,' will leads to interpretate hstr and lstr as divided by `,'
+# if parameters error then i should be more specific about what error in parameters detected
+# document _inituid(): parameters; document cs: uid initialization string format
+# test with escape char
+# adv hstr and lstr splitting?
+# chk if hstr len==0 ?
+# return _tclass & report error?
+# _tapi thru function
+
+# additional syntax checking ???
+# implement syntax and uid srv in docs
+# add _dumpuid() ????
+# make performance measurement
+# protection against badchar list
+# additional feature to specify _getuid() to not resurrect uid; and informative that uid was ressurected or not
+# build _defclass fn
+
+# _tuidinitcs ????
+# _tuidchrh[p]
+# _tuidchrl[p]
+# _tuidchr[p]
+# _tuidcnt[p]
+# _tUIDPFX[p]
+# _tUIDSFX[p]
+# _tUIDEL
+# _tUIDCNTH
+# _tUIDCNTL
+# _tUIDCHRL
+# _tUIDCHRH
+
+# create default class basic `new' and `del' functions
+
+
+
+function _tstini()
+{
+ _ini("uidel:pfx'hstr|lstr'sfx")
+ _ini("uidel:pfx'hstr|lstr'")
+ _ini("uidel:'hstr|lstr'sfx")
+ _ini("uidel:'hstr|lstr'")
+ _ini("uidel:pfx'hstr'sfx")
+ _ini("uidel:pfx'hstr'")
+ _ini("uidel:'hstr'sfx")
+ _ini("uidel:'hstr'")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _ini("pfx'hstr|lstr'sfx")
+ _ini("pfx'hstr|lstr'")
+ _ini("'hstr|lstr'sfx")
+ _ini("'hstr|lstr'")
+ _ini("pfx'hstr'sfx")
+ _ini("pfx'hstr'")
+ _ini("'hstr'sfx")
+ _ini("'hstr'")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _ini("uidel:pfx'`cntptr'sfx")
+ _ini("uidel:pfx'`cntptr'")
+ _ini("uidel:'`cntptr'sfx")
+ _ini("uidel:'`cntptr'")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _ini("pfx'`cntptr'sfx")
+ _ini("pfx'`cntptr'")
+ _ini("'`cntptr'sfx")
+ _ini("'`cntptr'")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _ini("uidel:pfx'^chrptr'sfx")
+ _ini("uidel:pfx'^chrptr'")
+ _ini("uidel:'^chrptr'sfx")
+ _ini("uidel:'^chrptr'")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+ _ini("pfx'^chrptr'sfx")
+ _ini("pfx'^chrptr'")
+ _ini("'^chrptr'sfx")
+ _ini("'^chrptr'")
+ _conl()
+ _conl("########################################################################################")
+ _conl()
+}
+
+function _tstv(p, A, r, f)
+{
+ if (f == "") {
+ f = "tst_splitstr"
+ }
+ @f(_NOP, A, p)
+ @f(AA0, A, p)
+ @f(AB0, A, p)
+ @f(AC0, A, p)
+ @f("", A, p)
+ @f("a", A, p)
+ @f("\264a", A, p)
+ @f("\264", A, p)
+ @f("a\264\264\264,ba\264\264\264,", A, p)
+ @f("\264,", A, p)
+ @f(",", A, p)
+ @f("\264a,", A, p)
+ @f("ab,", A, p)
+ @f("ab,\264", A, p)
+ @f("\264a\264,,ba", A, p)
+ @f(",a,,b\264,c,,\264a,,\264,,,", A, p)
+}
+
+function _typ(p)
+{
+ return (_t0 = (isarray(p) ? "#" : (p == 0 ? (p == "" ? 0 : (p in _CLASSPTR ? "`" : (p ? 3 : 4))) : (p in _CLASSPTR ? "`" : (p + 0 == p ? 5 : (p ? 3 : 2))))))
+}
+
+function _typa(p, A)
+{
+ return (_t0 = (isarray(p) ? "#" : (p == 0 ? (p == "" ? 0 : (p in A ? "`" : (p ? 3 : 4))) : (p in A ? "`" : (p + 0 == p ? 5 : (p ? 3 : 2))))))
+}
+
+#_____________________________________________________
+# _tframe0(hndstr,ptr)
+#
+#
+# IN:
+# MOD:
+# OUT:
+# RETURN:
+#
+# handler string:
+# Handler-string divides to words. Word splitter is char ";"
+#
+# Note that handler-string processed left to right. This mean that next word(more rightly) will overwrite fields implemented before(leftmost).
+# Note that if word-string contains more than one rexp-field then only last rexp-field(most rightly) will be applied.
+#_______________________________________________
+# TO DESIGN:
+#
+# 0-4: complete design of tlink handler call
+# 1-4: add new tlink handler call
+# 1-4: add new run fn (changed rexp to different for each type: see _tframe0)
+#
+# hndstr:
+# may be add rexp for each type of handler and also total rexp for all ??? ADDED (test)
+# may be add separator char ";" ??? ADDED (test)
+#_______________________________________________________________________
+function _tzend(a, b)
+{
+ #####################################################
+ if (b == 0 && b == "") {
+ return (_TEND[_TEND[_ARRLEN]] = a)
+ } else {
+ return (_TEND[_TEND[_ARRLEN] + a] = b)
+ }
+}
+
+function _uidcyc(p, i)
+{
+ _dumpuidgen(p)
+ for (i = 1; i < 64 * 8 * 6 - 1; i++) {
+ _conl(i ":" _var(_getuid(p)))
+ }
+ _dumpuidgen(p)
+}
+
+function _une(t)
+{
+ return gensub(/\xB4(.)/, "\\1", "G", t)
+}
+
+#___________________________________________________________________________________
+function _unformatrexp(t)
+{
+ _formatstrq0 = split(t, _FORMATSTRA, /(\\[0-9]{1,3})|(\\x[[:xdigit:]]+)|(\\.)/, _FORMATSTRB)
+ _formatstrs0 = ""
+ for (t = 1; t < _formatstrq0; t++) {
+ _formatstrs0 = _formatstrs0 _FORMATSTRA[t] ((_FORMATSTRB[t] in _QESCHR ? _QESCREXP[_FORMATSTRB[t]] : _QESCREXP[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))]))
+ }
+ return (_formatstrs0 _FORMATSTRA[t])
+}
+
+#___________________________________________________________
+function _unformatrexp_init(i, a)
+{
+ _formatstrs0 = "\\^$.[]|()*+?{}-sSwW<>yB`'"
+ delete _FORMATSTRB
+ for (i = 0; i < 256; i++) {
+ _QESCREXP["\\" _CHR[i]] = (index(_formatstrs0, _CHR[i]) ? "\\" _CHR[i] : _CHR[i])
+ }
+ for (i = 0; i < 256; i++) {
+ a = (index(_formatstrs0, _CHR[i]) ? "\\" : "")
+ _QESCREXP[sprintf("%.2X", i)] = a _CHR[i]
+ _QESCREXP["\\" sprintf("%.3o", i)] = a _CHR[i]
+ if (i < 8) {
+ _QESCREXP["\\" sprintf("%.1o", i)] = a _CHR[i]
+ }
+ if (i < 64) {
+ _QESCREXP["\\" sprintf("%.2o", i)] = a _CHR[i]
+ }
+ if (i < 16) {
+ _QESCREXP["\\x" sprintf("%.1X", i)] = _QESCREXP["\\x" sprintf("%.1x", i)] = a _CHR[i]
+ }
+ }
+ patsplit("a" 7 "b" 8 "f" 12 "n" 10 "r" 13 "t" 9 "v" 11, _FORMATSTRA, /[^0-9]/, _FORMATSTRB)
+ for (i in _FORMATSTRA) {
+ _QESCREXP["\\" _FORMATSTRA[i]] = _CHR[_FORMATSTRB[i] + 0]
+ }
+}
+
+#___________________________________________________________________________________
+function _unformatstr(t)
+{
+ _formatstrq0 = split(t, _FORMATSTRA, /(\\[0-9]{1,3})|(\\x[[:xdigit:]]+)|(\\.)/, _FORMATSTRB)
+ _formatstrs0 = ""
+ for (t = 1; t < _formatstrq0; t++) {
+ _formatstrs0 = _formatstrs0 _FORMATSTRA[t] ((_FORMATSTRB[t] in _QESCHR ? _QESCHR[_FORMATSTRB[t]] : _QESCHR[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))]))
+ }
+ return (_formatstrs0 _FORMATSTRA[t])
+}
+
+#___________________________________________________________
+function _unformatstr_init(i)
+{
+ for (i = 0; i < 256; i++) {
+ _QESCHR["\\" _CHR[i]] = _CHR[i]
+ }
+ for (i = 0; i < 256; i++) {
+ _QESCHR[sprintf("%.2X", i)] = _CHR[i]
+ _QESCHR["\\" sprintf("%.3o", i)] = _CHR[i]
+ if (i < 8) {
+ _QESCHR["\\" sprintf("%.1o", i)] = _CHR[i]
+ }
+ if (i < 64) {
+ _QESCHR["\\" sprintf("%.2o", i)] = _CHR[i]
+ }
+ if (i < 16) {
+ _QESCHR["\\x" sprintf("%.1X", i)] = _QESCHR["\\x" sprintf("%.1x", i)] = _CHR[i]
+ }
+ }
+ i = "a" 7 "b" 8 "f" 12 "n" 10 "r" 13 "t" 9 "v" 11
+ patsplit(i, _FORMATSTRA, /[^0-9]/, _FORMATSTRB)
+ for (i in _FORMATSTRA) {
+ _QESCHR["\\" _FORMATSTRA[i]] = _CHR[_FORMATSTRB[i] + 0]
+ }
+}
+
+#_____________________________________________________________________________
+function _uninit_del(A, i, p0)
+{
+ _del(i)
+}
+
+####################################################################################
+# PUBLIC:
+#_____________________________________________________________________________
+# var _SYS_STDOUT - (by default = "/dev/stdout") standart output pipe filename
+# var _SYS_STDERR - (by default = "/dev/stderr") standart error output pipe filename
+# var _SYS_STDCON - (by default = "CON") standart console output device
+#_____________________________________________________________________________
+# var _CHR["CR"] - return cursor to the position 0 without newline(normally ="\x0D")
+# var _CHR["EOL"] - return cursor to the position 0 & newline (MS:="\x0D\x0A" / UX:="\x0D")
+# var _CON_WIDTH - console width(columns number)
+#_____________________________________________________________________________
+# fn _cmd(c) - execute shell command c and return output
+# fn _err - output string w\o any addition into _SYS_STDERR device
+# fn _errnl - output string with addition _CHR["EOL"] at the end of the string into _SYS_STDERR device
+# fn _out - output string w\o any addition into _SYS_STDOUT device
+# fn _outnl - output string with addition _CHR["EOL"] at the end of the string into _SYS_STDOUT device
+#_____________________________________________________________________________
+# fn _con(text[,tabspace])
+# fn _conl(text[,tabspace])
+# fn _conline(text[,tabspace])
+# fn _constat(status[,tabspace])
+# fn _constatpush([status[,tabspace]])
+# fn _constatpop()
+#_______________________________________________________________________
+# var _constatstr
+####################################################################################
+
+
+function _unstr(t)
+{
+ return gensub(/\\(.)/, "\\1", "G", t)
+}
+
+#_________________________________________________________________
+function _untmp(f, a)
+{
+ #############################################
+ if (f = filepath(f)) {
+ if (match(f, /\\$/)) {
+ _deletepfx(_FILEIO_RDTMP, a = toupper(f))
+ _deletepfx(_FILEIO_RDNETMP, a)
} else {
- if (p == 0) {
- return v
- }
- if (v) {
- return _texclude(v)
- }
- return v
+ delete _FILEIO_RDNETMP[toupper(f)]
}
+ return f
}
-
- function _wFCHLD(p, v, a)
- {
- if (p) {
- if (v) {
- if (p == v) {
+ return ""
+}
+
+#_____________________________________________________________________________
+function _val(v, t)
+{
+ if (isarray(v)) {
+ return (_dumparr(v) _ln(t))
+ }
+ if (v == 0 && v == "") {
+ return (_ln("- (ERRNO=" ERRNO ")") _ln(t))
+ }
+ return (_ln(v "'") _ln(t))
+}
+
+#_____________________________________________________________________________
+function _val0(v)
+{
+ if (isarray(v)) {
+ return _dumparr(v)
+ }
+ if (v == 0 && v == "") {
+ return "-"
+ }
+ return ("\"" v "\"")
+}
+
+#_____________________________________________________________________________
+function _var(v, t)
+{
+ if (isarray(v)) {
+ return (_dumparr(v) _ln(t))
+ }
+ if (v == 0 && v == "") {
+ return (_ln("- (ERRNO=" ERRNO ")") _ln(t))
+ }
+ return (_ln(v "'") _ln(t))
+}
+
+#_______________________________________________________________________
+function _verb(t, d, A)
+{
+ ##################################################
+ if (_ERRLOG_VF) {
+ A["TYPE"] = "VERB"
+ A["TEXT"] = t
+ _log(A, d)
+ }
+}
+
+#_________________________________________________________________
+function _wFBRO(p, v, a)
+{
+ ###########################################
+ if (p) {
+ if (v) {
+ for (a = p; a in _tPARENT; ) {
+ if ((a = _tPARENT[a]) == v) {
return v
}
- for (a = p; a in _tPARENT; ) {
- if ((a = _tPARENT[a]) == v) {
- return v
- }
- }
+ }
+ ######################## v is parentesis of p
+ if (p in _tPARENT) {
+ p = _tPARENT[p]
if (v in _tNEXT) {
if (v in _tPREV) {
_tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
@@ -5925,11 +7271,8 @@
delete _tPREV[_tNEXT[v]]
}
}
- if (p in _tFCHLD) {
- ++_tQCHLD[p]
- return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
- }
- delete _tNEXT[v]
+ ++_tQCHLD[p]
+ return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
} else {
if (v in _tPREV) {
if (v in _tPARENT) {
@@ -5953,167 +7296,184 @@
delete _tQCHLD[a]
}
}
- if (p in _tFCHLD) {
- ++_tQCHLD[p]
- return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
- }
+ ++_tQCHLD[p]
+ return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
}
- _tQCHLD[p] = 1
- return (_tFCHLD[_tPARENT[v] = p] = _tLCHLD[p] = v)
} else {
- if (v == 0) {
- if (p in _tFCHLD) {
- v = _tFCHLD[p]
- delete _tFCHLD[p]
- delete _tLCHLD[p]
- delete _tQCHLD[p]
- do {
- delete _tPARENT[v]
- } while (v in _tNEXT && (v = _tNEXT[v]))
+ while (p in _tPREV) {
+ p = _tPREV[p]
+ }
+ if (v in _tPREV) {
+ if (v in _tPARENT) {
+ --_tQCHLD[a = _tPARENT[v]]
+ delete _tPARENT[v]
+ if (v in _tNEXT) {
+ _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
+ } else {
+ delete _tNEXT[_tLCHLD[a] = _tPREV[v]]
+ }
+ } else {
+ if (v in _tNEXT) {
+ _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
+ } else {
+ delete _tNEXT[_tPREV[v]]
+ }
+ }
+ delete _tPREV[v]
+ } else {
+ if (p == v) {
+ return v
+ }
+ if (v in _tPARENT) {
+ if (v in _tNEXT) {
+ delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]]
+ --_tQCHLD[a]
+ } else {
+ delete _tLCHLD[a = _tPARENT[v]]
+ delete _tFCHLD[a]
+ delete _tQCHLD[a]
+ }
+ delete _tPARENT[v]
+ } else {
+ if (v in _tNEXT) {
+ delete _tPREV[_tNEXT[v]]
+ }
}
}
- return v
+ return (_tPREV[_tNEXT[v] = p] = v)
}
} else {
- if (p == 0) {
+ if (v == 0) {
return v
}
+ ######################## p=ptr, v=0
+ return v
+ }
+ } else {
+ ######################## p=ptr, v=""
+ if (p == 0) {
return v
}
+ ######################## p=0
+ if (v) {
+ return _texclude(v)
+ }
+ ######################## p="", v=ptr - exclude v
+ return v
}
+}
- function _wLBRO(p, v, a)
- {
- if (p) {
- if (v) {
- for (a = p; a in _tPARENT; ) {
- if ((a = _tPARENT[a]) == v) {
- return v
- }
+#_________________________________________________________________
+function _wFCHLD(p, v, a)
+{
+ ##########################################
+ if (p) {
+ if (v) {
+ if (p == v) {
+ return v
+ }
+ ######################## p=v=ptr
+ for (a = p; a in _tPARENT; ) {
+ if ((a = _tPARENT[a]) == v) {
+ return v
}
- if (p in _tPARENT) {
- p = _tPARENT[p]
- if (v in _tPREV) {
- if (v in _tNEXT) {
- _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
- delete _tNEXT[v]
- if (v in _tPARENT) {
- if (p == (a = _tPARENT[v])) {
- return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[p]] = v)
- }
- --_tQCHLD[a]
- }
- } else {
- if (v in _tPARENT) {
- if (p == (a = _tPARENT[v])) {
- return v
- }
- delete _tNEXT[_tLCHLD[a] = _tPREV[v]]
- --_tQCHLD[a]
- } else {
- delete _tNEXT[_tPREV[v]]
- }
- }
- ++_tQCHLD[p]
- return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
- } else {
- if (v in _tNEXT) {
- if (v in _tPARENT) {
- delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]]
- if (p == a) {
- delete _tNEXT[v]
- return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[p]] = v)
- }
- --_tQCHLD[a]
- } else {
- delete _tPREV[_tNEXT[v]]
- }
- delete _tNEXT[v]
- } else {
- if (v in _tPARENT) {
- if (p == (a = _tPARENT[v])) {
- return v
- }
- delete _tLCHLD[a]
- delete _tFCHLD[a]
- delete _tQCHLD[a]
- }
+ }
+ ######################## v is parentesis of p
+ if (v in _tNEXT) {
+ if (v in _tPREV) {
+ _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
+ delete _tPREV[v]
+ if (v in _tPARENT) {
+ if (p == (a = _tPARENT[v])) {
+ return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[p]] = v)
}
- ++_tQCHLD[p]
- return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
+ --_tQCHLD[a]
}
} else {
- while (p in _tNEXT) {
- p = _tNEXT[p]
+ if (v in _tPARENT) {
+ if (p == (a = _tPARENT[v])) {
+ return v
+ }
+ delete _tPREV[_tFCHLD[a] = _tNEXT[v]]
+ --_tQCHLD[a]
+ } else {
+ delete _tPREV[_tNEXT[v]]
}
- if (v in _tNEXT) {
- if (v in _tPARENT) {
- --_tQCHLD[a = _tPARENT[v]]
- delete _tPARENT[v]
- if (v in _tPREV) {
- _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
- } else {
- delete _tPREV[_tFCHLD[a] = _tNEXT[v]]
- }
- } else {
- if (v in _tPREV) {
- _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
- } else {
- delete _tPREV[_tNEXT[v]]
- }
+ }
+ if (p in _tFCHLD) {
+ ++_tQCHLD[p]
+ return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
+ }
+ delete _tNEXT[v]
+ } else {
+ if (v in _tPREV) {
+ if (v in _tPARENT) {
+ delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]]
+ if (p == a) {
+ delete _tPREV[v]
+ return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[p]] = v)
}
- delete _tNEXT[v]
+ --_tQCHLD[a]
} else {
- if (p == v) {
+ delete _tNEXT[_tPREV[v]]
+ }
+ delete _tPREV[v]
+ } else {
+ if (v in _tPARENT) {
+ if (p == (a = _tPARENT[v])) {
return v
}
- if (v in _tPARENT) {
- if (v in _tPREV) {
- delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]]
- --_tQCHLD[a]
- } else {
- delete _tFCHLD[a = _tPARENT[v]]
- delete _tLCHLD[a]
- delete _tQCHLD[a]
- }
- delete _tPARENT[v]
- } else {
- if (v in _tPREV) {
- delete _tNEXT[_tPREV[v]]
- }
- }
+ delete _tFCHLD[a]
+ delete _tLCHLD[a]
+ delete _tQCHLD[a]
}
- return (_tNEXT[_tPREV[v] = p] = v)
}
- } else {
- if (v == 0) {
- return v
+ if (p in _tFCHLD) {
+ ++_tQCHLD[p]
+ return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v)
}
- return v
}
+ _tQCHLD[p] = 1
+ return (_tFCHLD[_tPARENT[v] = p] = _tLCHLD[p] = v)
} else {
- if (p == 0) {
- return v
- }
- if (v) {
- return _texclude(v)
+ if (v == 0) {
+ if (p in _tFCHLD) {
+ ######################## p=ptr, v=0 > delete all chld
+ v = _tFCHLD[p]
+ delete _tFCHLD[p]
+ delete _tLCHLD[p]
+ delete _tQCHLD[p]
+ do {
+ delete _tPARENT[v]
+ } while (v in _tNEXT && (v = _tNEXT[v]))
+ }
}
return v
}
+ } else {
+ ######################## p=ptr, v="" > ignore action
+ if (p == 0) {
+ return v
+ }
+ ######################## p=0
+ return v
}
+}
- function _wLCHLD(p, v, a)
- {
- if (p) {
- if (v) {
- if (p == v) {
+#_________________________________________________________________
+function _wLBRO(p, v, a)
+{
+ ###########################################
+ if (p) {
+ if (v) {
+ for (a = p; a in _tPARENT; ) {
+ if ((a = _tPARENT[a]) == v) {
return v
}
- for (a = p; a in _tPARENT; ) {
- if ((a = _tPARENT[a]) == v) {
- return v
- }
- }
+ }
+ ######################## v is parentesis of p
+ if (p in _tPARENT) {
+ p = _tPARENT[p]
if (v in _tPREV) {
if (v in _tNEXT) {
_tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
@@ -6135,11 +7495,8 @@
delete _tNEXT[_tPREV[v]]
}
}
- if (p in _tLCHLD) {
- ++_tQCHLD[p]
- return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
- }
- delete _tPREV[v]
+ ++_tQCHLD[p]
+ return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
} else {
if (v in _tNEXT) {
if (v in _tPARENT) {
@@ -6163,596 +7520,802 @@
delete _tQCHLD[a]
}
}
- if (p in _tLCHLD) {
- ++_tQCHLD[p]
- return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
- }
+ ++_tQCHLD[p]
+ return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
}
- _tQCHLD[p] = 1
- return (_tLCHLD[_tPARENT[v] = p] = _tFCHLD[p] = v)
} else {
- if (v == 0) {
- if (p in _tFCHLD) {
- v = _tFCHLD[p]
- delete _tFCHLD[p]
- delete _tLCHLD[p]
- delete _tQCHLD[p]
- do {
- delete _tPARENT[v]
- } while (v in _tNEXT && (v = _tNEXT[v]))
+ while (p in _tNEXT) {
+ p = _tNEXT[p]
+ }
+ if (v in _tNEXT) {
+ if (v in _tPARENT) {
+ --_tQCHLD[a = _tPARENT[v]]
+ delete _tPARENT[v]
+ if (v in _tPREV) {
+ _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
+ } else {
+ delete _tPREV[_tFCHLD[a] = _tNEXT[v]]
+ }
+ } else {
+ if (v in _tPREV) {
+ _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
+ } else {
+ delete _tPREV[_tNEXT[v]]
+ }
+ }
+ delete _tNEXT[v]
+ } else {
+ if (p == v) {
+ return v
+ }
+ if (v in _tPARENT) {
+ if (v in _tPREV) {
+ delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]]
+ --_tQCHLD[a]
+ } else {
+ delete _tFCHLD[a = _tPARENT[v]]
+ delete _tLCHLD[a]
+ delete _tQCHLD[a]
+ }
+ delete _tPARENT[v]
+ } else {
+ if (v in _tPREV) {
+ delete _tNEXT[_tPREV[v]]
+ }
}
}
- return v
+ return (_tNEXT[_tPREV[v] = p] = v)
}
} else {
- if (p == 0) {
+ if (v == 0) {
return v
}
+ ######################## p=ptr, v=0
return v
}
+ } else {
+ ######################## p=ptr, v=""
+ if (p == 0) {
+ return v
+ }
+ ######################## p=0
+ if (v) {
+ return _texclude(v)
+ }
+ ######################## p="", v=ptr - exclude v
+ return v
}
+}
- function _wLINK(p, v)
- {
- return (_tLINK[p] = v)
- }
-
- function _wNEXT(p, v, a, b)
- {
- if (p) {
- if (v) {
- if (p == v) {
+#_________________________________________________________________
+function _wLCHLD(p, v, a)
+{
+ ##########################################
+ if (p) {
+ if (v) {
+ if (p == v) {
+ return v
+ }
+ ######################## p=v=ptr
+ for (a = p; a in _tPARENT; ) {
+ if ((a = _tPARENT[a]) == v) {
return v
}
- for (a = p; a in _tPARENT; ) {
- if ((a = _tPARENT[a]) == v) {
- return v
- }
- }
- if (v in _tPREV) {
- if (p == (a = _tPREV[v])) {
- return v
- }
- if (v in _tNEXT) {
- _tPREV[_tNEXT[a] = _tNEXT[v]] = a
- if (v in _tPARENT) {
- --_tQCHLD[_tPARENT[v]]
- }
- } else {
- delete _tNEXT[a]
- if (v in _tPARENT) {
- _tLCHLD[b = _tPARENT[v]] = a
- --_tQCHLD[b]
+ }
+ ######################## v is parentesis of p
+ if (v in _tPREV) {
+ if (v in _tNEXT) {
+ _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
+ delete _tNEXT[v]
+ if (v in _tPARENT) {
+ if (p == (a = _tPARENT[v])) {
+ return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[p]] = v)
}
+ --_tQCHLD[a]
}
} else {
- if (v in _tNEXT) {
- if (v in _tPARENT) {
- delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]]
- --_tQCHLD[a]
- } else {
- delete _tPREV[_tNEXT[v]]
+ if (v in _tPARENT) {
+ if (p == (a = _tPARENT[v])) {
+ return v
}
+ delete _tNEXT[_tLCHLD[a] = _tPREV[v]]
+ --_tQCHLD[a]
} else {
- if (v in _tPARENT) {
- delete _tFCHLD[a = _tPARENT[v]]
- delete _tLCHLD[a]
- delete _tQCHLD[a]
- }
+ delete _tNEXT[_tPREV[v]]
}
}
- if (p in _tNEXT) {
- _tPREV[_tNEXT[v] = _tNEXT[p]] = v
- if (p in _tPARENT) {
- ++_tQCHLD[_tPARENT[v] = _tPARENT[p]]
+ if (p in _tLCHLD) {
+ ++_tQCHLD[p]
+ return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
+ }
+ delete _tPREV[v]
+ } else {
+ if (v in _tNEXT) {
+ if (v in _tPARENT) {
+ delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]]
+ if (p == a) {
+ delete _tNEXT[v]
+ return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[p]] = v)
+ }
+ --_tQCHLD[a]
} else {
- delete _tPARENT[v]
+ delete _tPREV[_tNEXT[v]]
}
- } else {
delete _tNEXT[v]
- if (p in _tPARENT) {
- ++_tQCHLD[_tPARENT[_tLCHLD[a] = v] = a = _tPARENT[p]]
- } else {
- delete _tPARENT[v]
+ } else {
+ if (v in _tPARENT) {
+ if (p == (a = _tPARENT[v])) {
+ return v
+ }
+ delete _tLCHLD[a]
+ delete _tFCHLD[a]
+ delete _tQCHLD[a]
}
}
- return (_tNEXT[_tPREV[v] = p] = v)
- } else {
- if (v == 0) {
- return v
+ if (p in _tLCHLD) {
+ ++_tQCHLD[p]
+ return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v)
}
- return v
}
+ _tQCHLD[p] = 1
+ return (_tLCHLD[_tPARENT[v] = p] = _tFCHLD[p] = v)
} else {
- if (p == 0) {
- return v
- }
- if (v) {
- return _texclude(v)
+ if (v == 0) {
+ if (p in _tFCHLD) {
+ ######################## p=ptr, v=0 > delete all chld
+ v = _tFCHLD[p]
+ delete _tFCHLD[p]
+ delete _tLCHLD[p]
+ delete _tQCHLD[p]
+ do {
+ delete _tPARENT[v]
+ } while (v in _tNEXT && (v = _tNEXT[v]))
+ }
}
return v
}
- }
-
- function _wPARENT(p, v)
- {
+ } else {
+ ######################## p=ptr, v="" > ignore action
+ if (p == 0) {
+ return v
+ }
+ ######################## p=0
return v
}
-
- function _wPREV(p, v, a, b)
- {
- if (p) {
- if (v) {
- if (p == v) {
+}
+
+#_________________________________________________________________
+function _wLINK(p, v)
+{
+ ##############################################
+ return (_tLINK[p] = v)
+}
+
+#_________________________________________________________________
+function _wNEXT(p, v, a, b)
+{
+ #########################################
+ if (p) {
+ if (v) {
+ if (p == v) {
+ return v
+ }
+ ######################## p=v=ptr
+ for (a = p; a in _tPARENT; ) {
+ if ((a = _tPARENT[a]) == v) {
return v
}
- for (a = p; a in _tPARENT; ) {
- if ((a = _tPARENT[a]) == v) {
- return v
- }
+ }
+ ######################## v is parentesis of p
+ if (v in _tPREV) {
+ if (p == (a = _tPREV[v])) {
+ return v
}
if (v in _tNEXT) {
- if (p == (a = _tNEXT[v])) {
- return v
- }
- if (v in _tPREV) {
- _tNEXT[_tPREV[a] = _tPREV[v]] = a
- if (v in _tPARENT) {
- --_tQCHLD[_tPARENT[v]]
- }
- } else {
- delete _tPREV[a]
- if (v in _tPARENT) {
- _tFCHLD[b = _tPARENT[v]] = a
- --_tQCHLD[b]
- }
+ _tPREV[_tNEXT[a] = _tNEXT[v]] = a
+ if (v in _tPARENT) {
+ --_tQCHLD[_tPARENT[v]]
}
} else {
- if (v in _tPREV) {
- if (v in _tPARENT) {
- delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]]
- --_tQCHLD[a]
- } else {
- delete _tNEXT[_tPREV[v]]
- }
- } else {
- if (v in _tPARENT) {
- delete _tLCHLD[a = _tPARENT[v]]
- delete _tFCHLD[a]
- delete _tQCHLD[a]
- }
+ delete _tNEXT[a]
+ if (v in _tPARENT) {
+ _tLCHLD[b = _tPARENT[v]] = a
+ --_tQCHLD[b]
}
}
- if (p in _tPREV) {
- _tNEXT[_tPREV[v] = _tPREV[p]] = v
- if (p in _tPARENT) {
- ++_tQCHLD[_tPARENT[v] = _tPARENT[p]]
+ } else {
+ if (v in _tNEXT) {
+ if (v in _tPARENT) {
+ delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]]
+ --_tQCHLD[a]
} else {
- delete _tPARENT[v]
+ delete _tPREV[_tNEXT[v]]
}
} else {
- delete _tPREV[v]
- if (p in _tPARENT) {
- ++_tQCHLD[_tPARENT[_tFCHLD[a] = v] = a = _tPARENT[p]]
- } else {
- delete _tPARENT[v]
+ if (v in _tPARENT) {
+ delete _tFCHLD[a = _tPARENT[v]]
+ delete _tLCHLD[a]
+ delete _tQCHLD[a]
}
}
- return (_tPREV[_tNEXT[v] = p] = v)
+ }
+ if (p in _tNEXT) {
+ _tPREV[_tNEXT[v] = _tNEXT[p]] = v
+ if (p in _tPARENT) {
+ ++_tQCHLD[_tPARENT[v] = _tPARENT[p]]
+ } else {
+ delete _tPARENT[v]
+ }
} else {
- if (v == 0) {
- return v
+ delete _tNEXT[v]
+ if (p in _tPARENT) {
+ ++_tQCHLD[_tPARENT[_tLCHLD[a] = v] = a = _tPARENT[p]]
+ } else {
+ delete _tPARENT[v]
}
- return v
}
+ return (_tNEXT[_tPREV[v] = p] = v)
} else {
- if (p == 0) {
+ if (v == 0) {
return v
}
- if (v) {
- return _texclude(v)
- }
+ ######################## p=ptr, v=0
return v
}
- }
-
- function _wQBRO(p, v)
- {
+ } else {
+ ######################## p=ptr, v=""
+ if (p == 0) {
+ return v
+ }
+ ######################## p=0
+ if (v) {
+ return _texclude(v)
+ }
+ ######################## p="", v=ptr - exclude v
return v
}
-
- function _wQCHLD(p, v)
- {
- if (p) {
- if (v) {
+}
+
+#_________________________________________________________________
+function _wPARENT(p, v)
+{
+ ############################################
+ return v
+}
+
+#_________________________________________________________________
+function _wPREV(p, v, a, b)
+{
+ #########################################
+ if (p) {
+ if (v) {
+ if (p == v) {
+ return v
+ }
+ ######################## p=v=ptr
+ for (a = p; a in _tPARENT; ) {
+ if ((a = _tPARENT[a]) == v) {
+ return v
+ }
+ }
+ ######################## v is parentesis of p
+ if (v in _tNEXT) {
+ if (p == (a = _tNEXT[v])) {
+ return v
+ }
+ if (v in _tPREV) {
+ _tNEXT[_tPREV[a] = _tPREV[v]] = a
+ if (v in _tPARENT) {
+ --_tQCHLD[_tPARENT[v]]
+ }
+ } else {
+ delete _tPREV[a]
+ if (v in _tPARENT) {
+ _tFCHLD[b = _tPARENT[v]] = a
+ --_tQCHLD[b]
+ }
+ }
} else {
- if (v == 0) {
- if (p in _tFCHLD) {
- v = _tFCHLD[p]
- delete _tFCHLD[p]
- delete _tLCHLD[p]
- delete _tQCHLD[p]
- do {
- delete _tPARENT[v]
- } while (v in _tNEXT && (v = _tNEXT[v]))
+ if (v in _tPREV) {
+ if (v in _tPARENT) {
+ delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]]
+ --_tQCHLD[a]
+ } else {
+ delete _tNEXT[_tPREV[v]]
+ }
+ } else {
+ if (v in _tPARENT) {
+ delete _tLCHLD[a = _tPARENT[v]]
+ delete _tFCHLD[a]
+ delete _tQCHLD[a]
}
}
- return v
}
+ if (p in _tPREV) {
+ _tNEXT[_tPREV[v] = _tPREV[p]] = v
+ if (p in _tPARENT) {
+ ++_tQCHLD[_tPARENT[v] = _tPARENT[p]]
+ } else {
+ delete _tPARENT[v]
+ }
+ } else {
+ delete _tPREV[v]
+ if (p in _tPARENT) {
+ ++_tQCHLD[_tPARENT[_tFCHLD[a] = v] = a = _tPARENT[p]]
+ } else {
+ delete _tPARENT[v]
+ }
+ }
+ return (_tPREV[_tNEXT[v] = p] = v)
} else {
- if (p == 0) {
+ if (v == 0) {
return v
}
+ ######################## p=ptr, v=0
return v
}
- }
-
- function _warning(t, d, A)
- {
- if (_ERRLOG_WF) {
- A["TYPE"] = "WARNING"
- A["TEXT"] = t
- _log(A, d)
+ } else {
+ ######################## p=ptr, v=""
+ if (p == 0) {
+ return v
}
+ ######################## p=0
+ if (v) {
+ return _texclude(v)
+ }
+ ######################## p="", v=ptr - exclude v
+ return v
}
-
- function _wfilerdnehnd(f, t)
- {
- if ((f = _filerdne(f)) == "") {
- return ""
+}
+
+#_________________________________________________________________
+function _wQBRO(p, v)
+{
+ ##############################################
+ return v
+}
+
+#_________________________________________________________________
+function _wQCHLD(p, v)
+{
+ #############################################
+ if (p) {
+ if (v) {
+ } else {
+ ######################## p=ptr, v=ptr
+ if (v == 0) {
+ if (p in _tFCHLD) {
+ ######################## p=ptr, v=0 > delete all chld
+ v = _tFCHLD[p]
+ delete _tFCHLD[p]
+ delete _tLCHLD[p]
+ delete _tQCHLD[p]
+ do {
+ delete _tPARENT[v]
+ } while (v in _tNEXT && (v = _tNEXT[v]))
+ }
+ }
+ return v
}
- if (! ((t = _filerd(f)) in _WFILEROOTDIR)) {
- _cmd("md \"" t "\" 2>NUL")
- _WFILEROOTDIR[t]
+ } else {
+ ######################## p=ptr, v="" > ignore action
+ if (p == 0) {
+ return v
}
- return f
+ ######################## p=0
+ return v
}
+}
- function _wonl(t)
- {
- wonl = wonl _ln(t)
+#_______________________________________________________________________
+function _warning(t, d, A)
+{
+ ###############################################
+ if (_ERRLOG_WF) {
+ A["TYPE"] = "WARNING"
+ A["TEXT"] = t
+ _log(A, d)
}
+}
- function _wonline(t)
- {
- wonl = wonl _ln(substr(" _ " t " _____________________________________________________________________________________________________________________________________", 1, 126))
+#___________________________________________________________
+function _wfilerdnehnd(f, t)
+{
+ if ((f = _filerdne(f)) == "") {
+ return ""
}
-
- function _wr_shortcut(f, S)
- {
- if (_shrtcutf0 = _filepath(f)) {
- ERRNO = ""
- _shrtcuta0 = _shortcut_fpath " /A:C /F:\"" _shrtcutf0 "\" 2>&1"
- for (f in _SHORTCUTWSTRUC) {
- if (f in S) {
- _shrtcuta0 = _shrtcuta0 " " _SHORTCUTWSTRUC[f] "\"" (gensub(/(\\?)$/, "\\1\\1", 1, S[f])) "\""
- }
- }
- if (_shortcut_nerr(_cmd(_shrtcuta0), _shrtcutf0)) {
- return
- }
- }
- return ((ERRNO ? ERRNO = "write shortcut: " ERRNO : _NOP))
+ if (! ((t = _filerd(f)) in _WFILEROOTDIR)) {
+ _cmd("md \"" t "\" 2>NUL")
+ _WFILEROOTDIR[t]
}
+ return f
+}
- function _wrfile(f, d, a, b)
- {
- if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
- ERRNO = "Filename error"
- return
- }
- a = BINMODE
- BINMODE = "rw"
- b = ORS
- ORS = ""
- ERRNO = ""
- print(d) > f
- if (ERRNO) {
- return ""
- }
- close(f)
- BINMODE = a
- ORS = b
- if (ERRNO) {
- return ""
- }
- return f
- }
+function _wonl(t)
+{
+ wonl = wonl _ln(t)
+}
- function _wrfile1(f, d, a, b)
- {
- if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
- ERRNO = "Filename error"
- return
- }
- a = BINMODE
- BINMODE = "rw"
- b = ORS
- ORS = ""
+function _wonline(t)
+{
+ wonl = wonl _ln(substr(" _ " t " _____________________________________________________________________________________________________________________________________", 1, 126))
+}
+
+#___________________________________________________________
+function _wr_shortcut(f, S)
+{
+ if (_shrtcutf0 = _filepath(f)) {
ERRNO = ""
- print(d) > f
- if (ERRNO) {
- return ""
+ _shrtcuta0 = _shortcut_fpath " /A:C /F:\"" _shrtcutf0 "\" 2>&1"
+ for (f in _SHORTCUTWSTRUC) {
+ if (f in S) {
+ _shrtcuta0 = _shrtcuta0 " " _SHORTCUTWSTRUC[f] "\"" (gensub(/(\\?)$/, "\\1\\1", 1, S[f])) "\""
+ }
}
- close(f)
- BINMODE = a
- ORS = b
- if (ERRNO) {
- return ""
+ if (_shortcut_nerr(_cmd(_shrtcuta0), _shrtcutf0)) {
+ return
}
- return d
}
+ return ((ERRNO ? ERRNO = "write shortcut: " ERRNO : _NOP))
+}
- function _yexport(p)
- {
- return _tframe("_yexport_i0", p)
+#_________________________________________________________________
+function _wrfile(f, d, a, b)
+{
+ #########################################
+ if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
+ ERRNO = "Filename error"
+ return
}
-
- function _yexport_i0(p, p0, p1, p2)
- {
- if (p in _tLOG) {
- return ("_ERRLOG: " _Zexparr(_tLOG[p]) "\n")
- }
- if (p in _tSTR) {
- p = _tSTR[p]
- gsub(/\x1B/, "\033;", p)
- gsub(/\x0A/, "\033:", p)
- return (p "\n")
- }
+ a = BINMODE
+ BINMODE = "rw"
+ b = ORS
+ ORS = ""
+ ERRNO = ""
+ print(d) > f
+ if (ERRNO) {
+ return ""
}
-
- function cmp_str_idx(i1, v1, i2, v2)
- {
- return ((i1 < i2 ? -1 : 1))
+ close(f)
+ BINMODE = a
+ ORS = b
+ if (ERRNO) {
+ return ""
}
+ return f
+}
- function filedi(f, d)
- {
- if ((f = filerdnehndi(f)) == "") {
- return _FILEIO_D
- }
- if (f in _FILEDIRFL) {
- return _FILEDIR[f]
- }
- if (f in _FILEROOT) {
- if (d = filegetdrvdir(_FILEROOT[f])) {
- _FILEDIRFL[f]
- }
- return (_FILEDIR[f] = d _FILEDIR[f])
- }
- if ((_FILEIO_RD, f) in _FILEDIR) {
- return _FILEDIR[_FILEIO_RD, f]
- }
- return (_FILEDIR[_FILEIO_RD, f] = _FILEIO_D _FILEDIR[f])
+#___________________________________________________________
+function _wrfile1(f, d, a, b)
+{
+ ##################################
+ if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
+ ERRNO = "Filename error"
+ return
}
-
- function filegetdrvdir(t, r)
- {
- if (t in _FILEDRV) {
- return _FILEDRV[t]
- }
- if (match(r = _cmd("cd " t " 2>NUL"), /[^\x00-\x1F]+/)) {
- r = gensub(/[ \t]*([\\\$\:])[ \t]*/, "\\1", "G", substr(r, RSTART, RLENGTH))
- gsub(/(^[ \t]*)|([ \t]*$)/, "", r)
- if (match(r, /\:(.*)/)) {
- return (_FILEDRV[tolower(t)] = _FILEDRV[toupper(t)] = substr(r, RSTART + 1) ((r ~ /\\$/ ? "" : "\\")))
- }
- }
+ a = BINMODE
+ BINMODE = "rw"
+ b = ORS
+ ORS = ""
+ ERRNO = ""
+ print(d) > f
+ if (ERRNO) {
return ""
}
-
- function filegetrootdir(f, dd, d)
- {
- if (f in _FILEDIRFL) {
- if (f in _FILEROOT) {
- return (_FILEROOT[f] _FILEDIR[f])
- }
- if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) {
- return (_FILEROOT[dd, f] _FILEDIR[f])
- }
- return ((_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[f])
- }
+ close(f)
+ BINMODE = a
+ ORS = b
+ if (ERRNO) {
+ return ""
+ }
+ return d
+}
+
+#_______________________________________________________________________
+function _yexport(p)
+{
+ #####################################################
+ return _tframe("_yexport_i0", p)
+}
+
+#_______________________________________________________________________
+function _yexport_i0(p, p0, p1, p2)
+{
+ if (p in _tLOG) {
+ return ("_ERRLOG: " _Zexparr(_tLOG[p]) "\n")
+ }
+ if (p in _tSTR) {
+ p = _tSTR[p]
+ gsub(/\x1B/, "\033;", p)
+ gsub(/\x0A/, "\033:", p)
+ return (p "\n")
+ }
+}
+
+#_________________________________________________________________
+function cmp_str_idx(i1, v1, i2, v2)
+{
+ ##############################
+ return ((i1 < i2 ? -1 : 1))
+}
+
+#___________________________________________________________
+function filedi(f, d)
+{
+ if ((f = filerdnehndi(f)) == "") {
+ return _FILEIO_D
+ }
+ if (f in _FILEDIRFL) {
+ return _FILEDIR[f]
+ }
+ if (f in _FILEROOT) {
+ if (d = filegetdrvdir(_FILEROOT[f])) {
+ _FILEDIRFL[f]
+ }
+ return (_FILEDIR[f] = d _FILEDIR[f])
+ }
+ if ((_FILEIO_RD, f) in _FILEDIR) {
+ return _FILEDIR[_FILEIO_RD, f]
+ }
+ return (_FILEDIR[_FILEIO_RD, f] = _FILEIO_D _FILEDIR[f])
+}
+
+#___________________________________________________________
+function filegetdrvdir(t, r)
+{
+ if (t in _FILEDRV) {
+ return _FILEDRV[t]
+ }
+ if (match(r = _cmd("cd " t " 2>NUL"), /[^\x00-\x1F]+/)) {
+ r = gensub(/[ \t]*([\\\$\:])[ \t]*/, "\\1", "G", substr(r, RSTART, RLENGTH))
+ gsub(/(^[ \t]*)|([ \t]*$)/, "", r)
+ if (match(r, /\:(.*)/)) {
+ return (_FILEDRV[tolower(t)] = _FILEDRV[toupper(t)] = substr(r, RSTART + 1) ((r ~ /\\$/ ? "" : "\\")))
+ }
+ }
+ return ""
+}
+
+#___________________________________________________________
+function filegetrootdir(f, dd, d)
+{
+ if (f in _FILEDIRFL) {
if (f in _FILEROOT) {
- if (d = filegetdrvdir(_FILEROOT[f])) {
- _FILEDIRFL[f]
- return (_FILEROOT[f] (_FILEDIR[f] = d _FILEDIR[f]))
- } else {
- return (_FILEROOT[f] _FILEDIR[f])
- }
+ return (_FILEROOT[f] _FILEDIR[f])
}
if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) {
- if ((dd, f) in _FILEDIR) {
- return (_FILEROOT[dd, f] _FILEDIR[dd, f])
- }
- if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) {
- return (_FILEROOT[dd, f] (_FILEDIR[dd, f] = d))
- }
- return (_FILEROOT[dd, f] d)
+ return (_FILEROOT[dd, f] _FILEDIR[f])
}
+ return ((_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[f])
+ }
+ if (f in _FILEROOT) {
+ if (d = filegetdrvdir(_FILEROOT[f])) {
+ _FILEDIRFL[f]
+ return (_FILEROOT[f] (_FILEDIR[f] = d _FILEDIR[f]))
+ } else {
+ return (_FILEROOT[f] _FILEDIR[f])
+ }
+ }
+ if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) {
if ((dd, f) in _FILEDIR) {
- return ((_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[dd, f])
+ return (_FILEROOT[dd, f] _FILEDIR[dd, f])
}
if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) {
- return ((_FILEROOT[dd, f] = fileri(dd)) (_FILEDIR[dd, f] = d))
+ return (_FILEROOT[dd, f] (_FILEDIR[dd, f] = d))
}
- return ((_FILEROOT[dd, f] = fileri(dd)) d)
+ return (_FILEROOT[dd, f] d)
+ }
+ if ((dd, f) in _FILEDIR) {
+ return ((_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[dd, f])
}
+ if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) {
+ return ((_FILEROOT[dd, f] = fileri(dd)) (_FILEDIR[dd, f] = d))
+ }
+ return ((_FILEROOT[dd, f] = fileri(dd)) d)
+}
- function filerdnehndi(st, a, c, r, d, n, A)
- {
- if (st) {
- if ((c = toupper(st)) in _FILECACHE) {
- return _FILECACHE[c]
- }
- if (match(st, /^[ \t]*\\[ \t]*\\/)) {
- if (match(substr(st, a = RLENGTH + 1), /^[ \t]*([0-9A-Za-z\-]+)[ \t]*(\\[ \t]*([A-Za-z])[ \t]*\$[ \t]*)?(\\[ \t]*([0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)*[ \t]*)?(([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)) {
- a = a + RLENGTH
- d = ((A[3] ? "\\" A[3] "$" : "")) "\\" A[5]
- gsub(/[ \t]*\\[ \t]*/, "\\", d)
- if ((st = toupper((r = "\\\\" A[1]) d (n = A[8]))) in _FILECACHE) {
- return (_FILECACHE[substr(c, 1, a)] = _FILECACHE[st])
- }
- _FILEDIR[c = _FILECACHE[substr(c, 1, a)] = _FILECACHE[st] = ++_file_rootcntr] = d
- _FILEDIRFL[c]
- _FILEROOT[c] = r
- } else {
- _filepath_err = "UNC"
- return ""
- }
- } else {
- match(st, /^(([ \t]*\.[ \t]*\\[ \t]*)|(([ \t]*([A-Za-z])[ \t]*(\:)[ \t]*)?([ \t]*(\\)[ \t]*)?))([ \t]*(([ \t]*[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+)[ \t]*)?([ \t]*([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)
- if (! RLENGTH) {
- return ""
- }
- d = A[8] A[10]
+#___________________________________________________________
+function filerdnehndi(st, a, c, r, d, n, A)
+{
+ if (st) {
+ if ((c = toupper(st)) in _FILECACHE) {
+ return _FILECACHE[c]
+ }
+ if (match(st, /^[ \t]*\\[ \t]*\\/)) {
+ if (match(substr(st, a = RLENGTH + 1), /^[ \t]*([0-9A-Za-z\-]+)[ \t]*(\\[ \t]*([A-Za-z])[ \t]*\$[ \t]*)?(\\[ \t]*([0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)*[ \t]*)?(([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)) {
+ a = a + RLENGTH
+ d = ((A[3] ? "\\" A[3] "$" : "")) "\\" A[5]
gsub(/[ \t]*\\[ \t]*/, "\\", d)
- if ((st = toupper((r = A[5] A[6]) d (n = A[14]))) in _FILECACHE) {
- return (_FILECACHE[substr(c, 1, RLENGTH)] = _FILECACHE[st])
- }
- _FILEDIR[c = _FILECACHE[substr(c, 1, RLENGTH)] = _FILECACHE[st] = ++_file_rootcntr] = d
- if (A[8]) {
- _FILEDIRFL[c]
- }
- if (r) {
- _FILEROOT[c] = r
+ if ((st = toupper((r = "\\\\" A[1]) d (n = A[8]))) in _FILECACHE) {
+ return (_FILECACHE[substr(c, 1, a)] = _FILECACHE[st])
}
+ _FILEDIR[c = _FILECACHE[substr(c, 1, a)] = _FILECACHE[st] = ++_file_rootcntr] = d
+ _FILEDIRFL[c]
+ _FILEROOT[c] = r
+ } else {
+ _filepath_err = "UNC"
+ return ""
}
- if (n) {
- if (match(n, /\.[^\.]*$/)) {
- _FILEXT[c] = substr(n, RSTART)
- _FILENAM[c] = substr(n, 1, RSTART - 1)
- } else {
- _FILENAM[c] = n
- }
+ } else {
+ match(st, /^(([ \t]*\.[ \t]*\\[ \t]*)|(([ \t]*([A-Za-z])[ \t]*(\:)[ \t]*)?([ \t]*(\\)[ \t]*)?))([ \t]*(([ \t]*[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+)[ \t]*)?([ \t]*([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)
+ if (! RLENGTH) {
+ return ""
+ }
+ d = A[8] A[10]
+ gsub(/[ \t]*\\[ \t]*/, "\\", d)
+ if ((st = toupper((r = A[5] A[6]) d (n = A[14]))) in _FILECACHE) {
+ return (_FILECACHE[substr(c, 1, RLENGTH)] = _FILECACHE[st])
+ }
+ _FILEDIR[c = _FILECACHE[substr(c, 1, RLENGTH)] = _FILECACHE[st] = ++_file_rootcntr] = d
+ if (A[8]) {
+ _FILEDIRFL[c]
+ }
+ if (r) {
+ _FILEROOT[c] = r
}
- return c
- }
- return ""
- }
-
- function fileri(f)
- {
- if ((f = filerdnehndi(f)) == "") {
- return _FILEIO_R
- }
- if (f in _FILEROOT) {
- return _FILEROOT[f]
- }
- if ((_FILEIO_RD, f) in _FILEROOT) {
- return _FILEROOT[_FILEIO_RD, f]
}
- return (_FILEROOT[_FILEIO_RD, f] = _FILEIO_R)
- }
-
- function hujf(a, b, c)
- {
- _conl("hujf(" a "," b "," c ")")
- }
-
- function ncmp_str_idx(i1, v1, i2, v2)
- {
- return ((i1 < i2 ? 1 : -1))
- }
-
- function test_cfg(p, z, AA0, a)
- {
- AA0[1]
- _fclass = _cfguid(p = _getuid(_classys), _NOP, _NOP, _NOP, _NOP, _classys)
- _conl()
- _conline()
- _conl()
- _drawuid(p)
- _fclass = _cfguid(p = _getuid(_classys), AA0, AA0, AA0, AA0, _classys)
- _conl()
- _conline()
- _conl()
- _drawuid(p)
- a = _getuid(z = _fclass = _cfguid(p = _getuid(_classys), p, "<", ">", "ab", "cd"))
- _conl("### " a "########")
- _conline()
- _conl()
- _drawuid(p)
- a = _getuid(_fclass = _cfguid(p = _getuid(_classys), z, 0, 0, _NOP, z))
- _conl("### " a "########")
- _conline()
- _conl()
- _drawuid(p)
- a = _getuid(_fclass = _cfguid(p = _getuid(_classys), z, "^", "$", z, _classys))
- _conl("### " a "########")
- _conline()
- _conl()
- _drawuid(p)
- _fclass = _cfguid(p = _getuid(_classys), "oblptr", "pfx", "sfx", "abcd")
- _conl()
- _conline()
- _conl()
- _drawuid(p)
- _conl("```````````````````" z "'''''''''" ((_isptr(z) ? " ptr" : " not ptr")))
- _drawuid(z)
- }
-
- function test_splitstr(A)
- {
- AA0[-1] = "huj"
- AA0["A"] = "pizda"
- AA0[1] = "zhopa"
- delete AB0[AB0[""] = ""]
- AC0[-1] = "HUJ"
- AC0["A"] = "PIZDA"
- AC0[1] = "ZHOPA"
- _SPLITSTRB0["1"]
- wonl = ""
- _tstv(0, A, 0, "_tstv")
- _conl(wonl)
- _wrfile("wonl.out", wonl)
- }
-
- function test_uid(p, i)
- {
- _fclass = _cfguid(p = _getuid(_classys), p, "pfx", "sfx", "abc")
- _conl("_fclass uid: " _getuid(_fclass))
- _drawuid(_fclass)
- _conl("_classys uid: " _getuid(_classys)) _drawuid(_classys)
- for (i = 1; i < 81; i++) {
- _conl(i ": " _getuid(_fclass))
- }
- _drawuid(_fclass)
- }
-
- function tst_splitstr(t, A, R, r)
- {
- delete A
- A["not cleared"]
- _wonl()
- _wonline("_splitstr(" ((isarray(t) ? "ARR" ((length(t) > 0 ? "#" ((t[1] != "zhopa" ? "U" : "l")) : "")) : _val0(t))) ",A" ((isarray(R) ? ", ARR" ((length(R) > 0 ? "#" ((R[1] != "zhopa" ? "U" : "l")) : "")) : ", " _val0(R))) "):")
- _wonl(_val0(r = _splitstr(t, A, R)))
- _wonl("arrary A:")
- _wonl(_dumparr(A))
- return r
- }
-
- function tts(p, uidel, psfx, cnt, chr, p5, p6, p7, im)
- {
- im = " "
- im = ".. .."
- _conl("ret: " _qparam(im, p, uidel, psfx, cnt, chr, p5, p6, p7) "'")
- _conl("mask: `" _qparamask "'")
- }
-
- function zorr(A, i, r)
- {
- if (i in A) {
- _conl("`" i "' in A")
- } else {
- _conl("`" i "' not in A")
+ if (n) {
+ if (match(n, /\.[^\.]*$/)) {
+ _FILEXT[c] = substr(n, RSTART)
+ _FILENAM[c] = substr(n, 1, RSTART - 1)
+ } else {
+ _FILENAM[c] = n
+ }
}
- r = A[i] == "" && A[i] == 0
- _conl("A[" i "] status is " r)
- return
- a = a + -a
- _conl("``````````````" a "''''''''''''''''")
- }
-
- function zzer()
- {
+ return c
}
+ return ""
+}
+
+#_____________________________________________________
+function fileri(f)
+{
+ if ((f = filerdnehndi(f)) == "") {
+ return _FILEIO_R
+ }
+ if (f in _FILEROOT) {
+ return _FILEROOT[f]
+ }
+ if ((_FILEIO_RD, f) in _FILEROOT) {
+ return _FILEROOT[_FILEIO_RD, f]
+ }
+ return (_FILEROOT[_FILEIO_RD, f] = _FILEIO_R)
+}
+
+function hujf(a, b, c)
+{
+ _conl("hujf(" a "," b "," c ")")
+}
+
+#___________________________________________________________
+function ncmp_str_idx(i1, v1, i2, v2)
+{
+ #######################
+ return ((i1 < i2 ? 1 : -1))
+}
+
+function test_cfg(p, z, AA0, a)
+{
+ AA0[1]
+ _fclass = _cfguid(p = _getuid(_classys), _NOP, _NOP, _NOP, _NOP, _classys)
+ _conl()
+ _conline()
+ _conl()
+ _drawuid(p)
+ _fclass = _cfguid(p = _getuid(_classys), AA0, AA0, AA0, AA0, _classys)
+ _conl()
+ _conline()
+ _conl()
+ _drawuid(p)
+ a = _getuid(z = _fclass = _cfguid(p = _getuid(_classys), p, "<", ">", "ab", "cd"))
+ _conl("### " a "########")
+ _conline()
+ _conl()
+ _drawuid(p)
+ a = _getuid(_fclass = _cfguid(p = _getuid(_classys), z, 0, 0, _NOP, z))
+ _conl("### " a "########")
+ _conline()
+ _conl()
+ _drawuid(p)
+ a = _getuid(_fclass = _cfguid(p = _getuid(_classys), z, "^", "$", z, _classys))
+ _conl("### " a "########")
+ _conline()
+ _conl()
+ _drawuid(p)
+ _fclass = _cfguid(p = _getuid(_classys), "oblptr", "pfx", "sfx", "abcd")
+ _conl()
+ _conline()
+ _conl()
+ _drawuid(p)
+ _conl("```````````````````" z "'''''''''" ((_isptr(z) ? " ptr" : " not ptr")))
+ _drawuid(z)
+}
+
+function test_splitstr(A)
+{
+ AA0[-1] = "huj"
+ AA0["A"] = "pizda"
+ AA0[1] = "zhopa"
+ delete AB0[AB0[""] = ""]
+ AC0[-1] = "HUJ"
+ AC0["A"] = "PIZDA"
+ AC0[1] = "ZHOPA"
+ _SPLITSTRB0["1"]
+ wonl = ""
+ _tstv(0, A, 0, "_tstv")
+ _conl(wonl)
+ _wrfile("wonl.out", wonl)
+}
+
+function test_uid(p, i)
+{
+ #test_cfg()
+ #return
+
+ _fclass = _cfguid(p = _getuid(_classys), p, "pfx", "sfx", "abc")
+ #_fclass=_cfguid(p=_getuid(_classys),_NOP,_NOP,_NOP,"",_classys)
+ _conl("_fclass uid: " _getuid(_fclass))
+ _drawuid(_fclass)
+ _conl("_classys uid: " _getuid(_classys)) _drawuid(_classys)
+ for (i = 1; i < 81; i++) {
+ _conl(i ": " _getuid(_fclass))
+ }
+ _drawuid(_fclass)
+}
+
+function tst_splitstr(t, A, R, r)
+{
+ delete A
+ A["not cleared"]
+ _wonl()
+ _wonline("_splitstr(" ((isarray(t) ? "ARR" ((length(t) > 0 ? "#" ((t[1] != "zhopa" ? "U" : "l")) : "")) : _val0(t))) ",A" ((isarray(R) ? ", ARR" ((length(R) > 0 ? "#" ((R[1] != "zhopa" ? "U" : "l")) : "")) : ", " _val0(R))) "):")
+ _wonl(_val0(r = _splitstr(t, A, R)))
+ _wonl("arrary A:")
+ _wonl(_dumparr(A))
+ return r
+}
+
+function tts(p, uidel, psfx, cnt, chr, p5, p6, p7, im)
+{
+ im = " "
+ im = ".. .."
+ _conl("ret: " _qparam(im, p, uidel, psfx, cnt, chr, p5, p6, p7) "'")
+ _conl("mask: `" _qparamask "'")
+}
+
+# # - p is array
+# ` - p is ptr detected in array _CLASSPTR(for _typ); or p is ptr detected in array A(for _typa)
+# 0 - p is undefined
+
+# 2 - p is string==""
+# 3 - p is string!=""
+# 4 - p is number 0
+# 5 - p is any number except 0(positive and negative)
+
+# str: _typ(p)+0 !_typ(p)+0
+# str/ptr _typ(p)>0 _typ(p)<1
+# str/arr "`">_typ(p0) && _t0
+# str/ptr/arr _typ(p) !_typ(p)
+# ptr _typ(p)=="`" _typ(p)<"`" ?
+# ptr/arr _typ(p)+0!=_t0
+# arr _typ(p)=="#" _typ(p)>"#" ?
+
+function zorr(A, i, r)
+{
+ if (i in A) {
+ _conl("`" i "' in A")
+ } else {
+ _conl("`" i "' not in A")
+ }
+ r = A[i] == "" && A[i] == 0
+ _conl("A[" i "] status is " r)
+ return
+ a = a + -a
+ _conl("``````````````" a "''''''''''''''''")
+}
+
+#_____________________________________________________________________________
+function zzer()
+{
+ ################################################################
+}