From e6f47400e8b9e1818be03e4469cd69af87ecb7bc Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 21 Jul 2023 04:57:25 -1000 Subject: [PATCH] SCP: Cleanup EXPECT help --- scp.c | 151 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 80 insertions(+), 71 deletions(-) diff --git a/scp.c b/scp.c index b612430e..62108e5f 100644 --- a/scp.c +++ b/scp.c @@ -2276,27 +2276,27 @@ static const char simh_help2[] = "++EXPECT {dev:line} {[count]} {HALTAFTER=n,}\"\" {actioncommand {; actioncommand}...}\n\n" "++NOEXPECT {dev:line} \"\"\n\n" "++SHOW EXPECT {dev:line}\n\n" - " The string argument must be delimited by quote characters. Quotes may\n" - " be either single or double but the opening and closing quote characters\n" - " must match. Data in the string may contain escaped character strings.\n" - " If a [count] is specified, the rule will match after the match string\n" - " has matched count times.\n\n" - " When multiple expect rules are defined with the same match string, they\n" - " will match in the same order they were defined in.\n\n" + " The string argument must be delimited by quote characters. Quotes\n" + " may be either single or double but the opening and closing quote\n" + " characters must match. Data in the string may contain escaped\n" + " character strings. If a [count] is specified, the rule will match\n" + " after the match string has matched count times.\n\n" + " When multiple expect rules are defined with the same match string,\n" + " they will match in the same order they were defined in.\n\n" " When expect rules are defined, they are evaluated agains recently\n" - " produced output as each character is output to the device. Since this\n" - " evaluation processing is done on each output character, rule matching\n" - " is not specifically line oriented. If line oriented matching is desired\n" - " then rules should be defined which contain the simulated system's line\n" - " ending character sequence (i.e. \"\\r\\n\").\n" - " Once data has matched any expect rule, that data is no longer eligible\n" - " to match other expect rules which may already be defined.\n" - " Data which is output prior to the definition of an expect rule is not\n" - " eligible to be matched against.\n\n" - " The NOEXPECT command removes a previously defined EXPECT command for the\n" - " console or a specific multiplexer line. A NOEXPECT command, without a\n" - " specific mention of a particular EXPECT match string, will remove all\n" - " currently defined EXPECT match rules.\n\n" + " produced output as each character is output to the device. Since\n" + " this evaluation processing is done on each output character, rule\n" + " matching is not specifically line oriented. If line oriented\n" + " matching is desired then rules should be defined which contain the\n" + " simulated system's line ending character sequence (i.e. \"\\r\\n\").\n" + " Once data has matched any expect rule, that data is no longer\n" + " eligible to match other expect rules which may already be defined.\n" + " Data which is output prior to the definition of an expect rule is\n" + " not eligible to be matched against.\n\n" + " The NOEXPECT command removes a previously defined EXPECT command\n" + " for the console or a specific multiplexer line. A NOEXPECT command,\n" + " without a specific mention of a particular EXPECT match string, will\n" + " remove all currently defined EXPECT match rules.\n\n" " The SHOW EXPECT command displays all of the pending EXPECT state for\n" " the console or a specific multiplexer line.\n" /***************** 80 character line width template *************************/ @@ -2305,79 +2305,80 @@ static const char simh_help2[] = "5-p\n" " EXPECT rules default to be one shot activities. That is a rule is\n" " automatically removed when it matches unless it is designated as a\n" - " persistent rule by using a -p switch when the rule is defined.\n" + " persistent rule by using a -p switch when the rule is defined.\n\n" "5-c\n" " If an expect rule is defined with the -c switch, it will cause all\n" " pending expect rules on the current device to be cleared when the rule\n" - " matches data in the device output stream.\n" + " matches data in the device output stream.\n\n" "5-r\n" - " If an expect rule is defined with the -r switch, the string is interpreted\n" - " as a regular expression applied to the output data stream. This regular\n" - " expression may contain parentheses delimited sub-groups.\n\n" + " If an expect rule is defined with the -r switch, the string is\n" + " interpreted as a regular expression applied to the output data\n" + " stream. This regular expression may contain parentheses delimited\n" + " sub-groups.\n\n" /***************** 80 character line width template *************************/ -#if defined (HAVE_PCRE_H) - " The syntax of the regular expressions available are those supported by\n" - " the Perl Compatible Regular Expression package (aka PCRE). As the name\n" - " implies, the syntax is generally the same as Perl regular expressions.\n" - " See http://perldoc.perl.org/perlre.html for more details\n" -#else - " Regular expression support is not currently available on your environment.\n" - " This simulator could use regular expression support provided by the\n" - " Perl Compatible Regular Expression (PCRE) package if it was available\n" - " when you simulator was compiled.\n" -#endif + " The syntax of the regular expressions available are those supported\n" + " by the Perl Compatible Regular Expression package (aka PCRE). As\n" + " the name implies, the syntax is generally the same as Perl regular\n" + " expressions. See http://perldoc.perl.org/perlre.html for more\n\n" + " details.\n\n" "5-i\n" " If a regular expression expect rule is defined with the -i switch,\n" " character matching for that expression will be case independent.\n" - " The -i switch is only valid for regular expression expect rules.\n" + " The -i switch is only valid for regular expression expect rules.\n\n" "5-t\n" " The -t switch indicates that the value specified by the HaltAfter\n" - " parameter are in units of microseconds rather than %C.\n" + " parameter are in units of microseconds rather than %C.\n\n" "4Determining Which Output Matched\n" - " When an expect rule matches data in the output stream, the rule which\n" - " matched is recorded in the environment variable _EXPECT_MATCH_PATTERN.\n" - " If the expect rule was a regular expression rule, then the environment\n" - " variable _EXPECT_MATCH_GROUP_0 is set to the whole string which matched\n" - " and if the match pattern had any parentheses delimited sub-groups, the\n" - " environment variables _EXPECT_MATCH_GROUP_1 thru _EXPECT_MATCH_GROUP_n\n" - " are set to the values within the string which matched the respective\n" - " sub-groups.\n" + " When an expect rule matches data in the output stream, the rule\n" + " which matched is recorded in the environment variable\n" + " _EXPECT_MATCH_PATTERN. If the expect rule was a regular expression\n" + " rule, then the environment variable _EXPECT_MATCH_GROUP_0 is set to\n" + " the whole string which matched and if the match pattern had any\n" + " parentheses delimited sub-groups, the environment variables\n" + " _EXPECT_MATCH_GROUP_1 thru _EXPECT_MATCH_GROUP_n are set to the\n" + " values within the string which matched the respective sub-groups.\n\n" /***************** 80 character line width template *************************/ "4Escaping String Data\n" - " The following character escapes are explicitly supported when NOT using\n" - " regular expression match patterns:\n" - "++\\r Expect the ASCII Carriage Return character (Decimal value 13)\n" + " The following character escapes are explicitly supported when NOT\n" + " using regular expression match patterns:\n" + "++\\r Expect the ASCII Carriage Return character (Decimal\n" + "+++value 13)\n" "++\\n Expect the ASCII Linefeed character (Decimal value 10)\n" "++\\f Expect the ASCII Formfeed character (Decimal value 12)\n" - "++\\t Expect the ASCII Horizontal Tab character (Decimal value 9)\n" - "++\\v Expect the ASCII Vertical Tab character (Decimal value 11)\n" + "++\\t Expect the ASCII Horizontal Tab character (Decimal\n" + "+++value 9)\n" + "++\\v Expect the ASCII Vertical Tab character (Decimal\n" + "+++value 11)\n" "++\\b Expect the ASCII Backspace character (Decimal value 8)\n" "++\\\\ Expect the ASCII Backslash character (Decimal value 92)\n" - "++\\' Expect the ASCII Single Quote character (Decimal value 39)\n" - "++\\\" Expect the ASCII Double Quote character (Decimal value 34)\n" - "++\\? Expect the ASCII Question Mark character (Decimal value 63)\n" + "++\\' Expect the ASCII Single Quote character (Decimal\n" + "+++value 39)\n" + "++\\\" Expect the ASCII Double Quote character (Decimal\n" + "+++value 34)\n" + "++\\? Expect the ASCII Question Mark character (Decimal\n" + "+++value 63)\n" "++\\e Expect the ASCII Escape character (Decimal value 27)\n" - " as well as octal character values of the form:\n" - "++\\n{n{n}} where each n is an octal digit (0-7)\n" - " and hext character values of the form:\n" - "++\\xh{h} where each h is a hex digit (0-9A-Fa-f)\n" + "++ as well as octal character values of the form:\n" + "+++\\n{n{n}} where each n is an octal digit (0-7)\n" + "++ and hex character values of the form:\n" + "+++\\xh{h} where each h is a hex digit (0-9A-Fa-f)\n\n" "4HaltAfter\n" " Specifies the number of %C which should be executed before\n" " simulator instruction execution should stop. The default is to stop\n" - " executing instructions immediately (i.e. HALTAFTER=0).\n" - " The default HaltAfter delay, once set, persists for all expect behaviors\n" - " for that device.\n" + " executing %C immediately (i.e. HALTAFTER=0).\n" + " The default HaltAfter delay, once set, persists for all expect\n" + " behaviors for that device.\n" " The default HaltAfter parameter value can be set by itself with:\n\n" "++EXPECT HALTAFTER=n\n\n" - " A unique HaltAfter value can be specified with each expect matching rule\n" - " which if it is not specified then the default value will be used.\n" - " To avoid potentially unpredictable system hehavior that will happen\n" - " if multiple expect rules are in effect and a haltafter value is large\n" - " enough for more than one expect rule to match before an earlier haltafter\n" - " delay has expired, only a single EXPECT rule can be defined if a non-zero\n" - " HaltAfter parameter has been set.\n" + " A unique HaltAfter value can be specified with each expect matching\n" + " rule which if it is not specified then the default value will be\n" + " used. To avoid potentially unpredictable system hehavior that will\n" + " happen if multiple expect rules are in effect and a haltafter value\n" + " is large enough for more than one expect rule to match before an\n" + " earlier haltafter delay has expired, only a single EXPECT rule can\n" + " be defined if a non-zero HaltAfter parameter has been set.\n" " The value n can be specified with a suffix of k or m which indicates\n" - " a multiplier of 1000 or 1000000 respectively\n" + " a multiplier of 1000 or 1000000 respectively.\n\n" /***************** 80 character line width template *************************/ #define HLP_SLEEP "*Commands Executing_Command_Files Pausing_Command_Execution" "3Pausing Command Execution\n" @@ -3037,7 +3038,11 @@ sim_disk_init (); /* init disk package */ sim_tape_init (); /* init tape package */ if ((argc > 2) && (sim_strcasecmp (argv[1], "CheckSourceCode") == 0)) { - return sim_check_source (argc - 1, argv + 1); + return sim_check_source (argc - 1, argv + 1); + sim_messagef (SCPE_NOFNC, "Missing PCRE support.\n"); + sim_messagef (SCPE_NOFNC, "Install the Perl Compatible Regular Expression (PCRE) package for\n"); + sim_messagef (SCPE_NOFNC, "your system and try again.\n"); + return EXIT_FAILURE; } for (i = 0; cmd_table[i].name; i++) { @@ -13626,7 +13631,11 @@ if (!match_buf) if (switches & EXP_TYP_REGEX) { #if !defined (USE_REGEX) free (match_buf); - return sim_messagef (SCPE_ARG, "RegEx support not available\n"); + sim_messagef (SCPE_ARG, "RegEx support is not available\n"); + sim_messagef (SCPE_ARG, "The necessary components for expect command regular expression\n"); + sim_messagef (SCPE_ARG, "support are not currently available on this system.\n"); + sim_messagef (SCPE_ARG, "Install the Perl Compatible Regular Expression (PCRE) package for\n"); + return sim_messagef (SCPE_ARG, "your system and try again.\n"); } #else /* USE_REGEX */ pcre *re;