home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / bin / readme.p2s < prev    next >
Text File  |  1999-05-11  |  28KB  |  609 lines

  1.  
  2.  
  3.                        P2STRING USER'S GUIDE AND REFERENCE
  4.  
  5.  
  6.  
  7.   SECTION 1.  INTRODUCTION
  8.   ________________________
  9.  
  10.  
  11.   P2STRING  is  a  test tool that exercises MMPM/2 via MCISENDSTRING  and other
  12.   APIs.  It accepts scripts of string commands and tool directives  to  control
  13.   the  tests.   Screen and file output of results are produced and overall test
  14.   termination status is logged.
  15.  
  16.  
  17.  
  18.   SECTION 2.  RUNNING P2STRING
  19.   ____________________________
  20.  
  21.  
  22.   2.1  INVOKING THE TOOL
  23.   ______________________
  24.  
  25.   P2STRING is invoked using the syntax shown below:
  26.  
  27.   p2string Script-file [-a]Output-file [-eError-file] [-d|D] [-E]
  28.            ______________________________________________________
  29.  
  30.   SCRIPT-FILE         The  name  of the file containing the MMPM/2 commands and
  31.                       P2STRING directives to be executed.  The format  for  the
  32.                       script  file  is described along with the script language
  33.                       syntax in the next section.
  34.  
  35.   [-a]OUTPUT-FILE     The name of the file to hold  the  dialog  of  the  test.
  36.                       This includes sent strings, logged strings, results, etc.
  37.                       By  default,  the  output-file  will contain only results
  38.                       from this test (eg.  existing output will be lost).
  39.  
  40.                       If the -a  command switch is used,  the  output  of  this
  41.                              __
  42.                       test will be appended to existing output.  Thus, a number
  43.                       of tests can be logged to the same output file.
  44.  
  45.   -EERROR-FILE        The  name of the file to receive messages of strings that
  46.                       failed.
  47.  
  48.   -d                  Instructs the tool to automatically terminate at the con-
  49.                       clusion of the scripts.  This switch should be used  when
  50.                       test  cases are run automatically.  There is no change in
  51.                       the output.  By default, the tool will display a  message
  52.                       indicating  the  script has finished and require the user
  53.                       to terminate the test.
  54.  
  55.   -D                  Behaves the same as the -d option except that the  script
  56.                                               __
  57.                       directives requiring user input are ignored.
  58.  
  59.   -E                  This  switch  causes  the  script to exit after the first
  60.                       error.   By  default,  scripts  will  run  to  conclusion
  61.                       regardless of errors.
  62.  
  63.   -s                  The P2STRING session will stop after the first error, if
  64.                       there is one, and the dialog will remain on the screen.
  65.                       If there are no errors, the tool will automatically
  66.                       terminate at the conclusion of the script.
  67.  
  68.   NOTE:  The command-line switches are case-sensitive.
  69.  
  70.   Sample command invocation lines:
  71.  
  72.        p2string cap_cdmc.001 cap_cdmc.l01
  73.        p2string cap_cdmc.001 -ap2string.OUT
  74.        p2string cap_cdmc.001 cap_cdmc.l01 -d
  75.        p2string cap_cdmc.001 -ap2string.OUT -d
  76.        p2string cap_cdmc.001 cap_cdmc.l01 -d -eMDM.ERR
  77.        p2string cap_cdmc.001 -aMDM.OUT -d -eMDM.ERR -E
  78.  
  79.  
  80.   2.2  OUTPUTS FROM THE TOOL
  81.   __________________________
  82.  
  83.   1.  Messages  are  displayed in the P2STRING window and logged to the output-
  84.       file specified on the command line.
  85.  
  86.       Messages include all non-comment lines read from the script, eg.   script
  87.       directives,   command  strings,  expected  return  values,  expected  and
  88.       received notify messages, and status lines.
  89.  
  90.   2.  The test termination status is logged.
  91.  
  92.   3.  Errors  and  debugging  statements  are  logged to the PMSTRING.LOG file,
  93.       opened in the current execution directory.  The amount of information  is
  94.       controled  by  debugging  switches  in the source files.   Critical error
  95.       statements are logged to this file unconditionally.
  96.  
  97.       There is no error logging to the STDERR  and  if  errors  are  suspected,
  98.       piping  handle 2 into a file will not have any effect.  PMSTRING.LOG file
  99.       serves as STDERR.
  100.  
  101.  
  102.   2.3  DISPLAY OPTIONS
  103.   ____________________
  104.  
  105.   The tool recognizes two environment variables which allow the user to manipu-
  106.   late  the  size  and  type  of  the  fonts.    To  specify  the   font,   use
  107.   P2STRING_FONTFACE  with  a  value  of:   SYSTEM, COURIER, TIMES, or HELVETICA
  108.   (default).  For example:   To specify the font  size,  use  P2STRING_FONTSIZE
  109.   with  possible values of:  8 (default), 10, 12, 14, or 18.  For example, type
  110.   the following from the command line before executing P2STRING:
  111.  
  112.        set P2STRING_FONTFACE=SYSTEM
  113.        set P2STRING_FONTSIZE=10
  114.  
  115.   NOTE:  Either or both may be specified.
  116.  
  117.  
  118.  
  119.   SECTION 3.  P2STRING SCRIPT SYNTAX
  120.   __________________________________
  121.  
  122.  
  123.   Script files may contain several types of lines:
  124.  
  125.   o   Comments
  126.   o   Tool Directives
  127.   o   MMPM/2 String Commands
  128.   o   Expected Return Strings
  129.   o   Expected Errors
  130.   o   Expected Notifies
  131.  
  132.  
  133.   3.1   COMMENTS
  134.   ______________
  135.  
  136.   Script  comment  lines must start with either ";" or "#" in the first column.
  137.   These comment lines will not be displayed nor echoed  into  the  output-file.
  138.   If you wish a remark to appear in the output, use the @REM directive.
  139.  
  140.  
  141.   3.2   TOOL DIRECTIVES
  142.   _____________________
  143.  
  144.   Tool  directives  start  with @ in the first column.  These directives effect
  145.   the execution and appearance of the output.  The following classes of  direc-
  146.   tives are recognized:  initialization and execution.
  147.  
  148.  
  149.   3.2.1  INITIALIZATION DIRECTIVES
  150.  
  151.   These  are  used  to setup the script.   As such, they must appear before any
  152.   execution commands.
  153.  
  154.   o   @PROCESSES="processes"
  155.  
  156.       "processes" = the number of processes the script will be dealing with.
  157.  
  158.   o   @THREADS="threads"
  159.  
  160.       "threads"= the number of threads script will be dealing with.
  161.  
  162.       NOTE:  @PROCESSES and @THREADS are mutually exclusive!
  163.  
  164.       NOTE:  There is a limitation of 10 processes or threads per script!
  165.  
  166.   o   @EVENTS={name[=0|1][,name[=0|1]]}
  167.  
  168.       Names of events are user defined with a maximum of 15 characters.  Events
  169.       may be set to 1 (for SET), or 0 (for CLEAR).  If no initialization values
  170.       is specified, the event is initialized to 0.
  171.  
  172.       For example:
  173.            @EVENTS={trey=1,jennifer=1,test=0}
  174.  
  175.  
  176.   3.2.2  EXECUTION DIRECTIVES
  177.  
  178.   o   @THREAD "number"
  179.  
  180.       Denotes  that  until the next @THREAD directive is encountered all of the
  181.       script lines belong to thread "number".
  182.  
  183.   o   @PROCESS "number"
  184.  
  185.       Denotes that until the next @PROCESS directive is encountered all of  the
  186.       script lines belong to process "number".
  187.  
  188.       NOTE:   @THREAD  and  @PROCESS are mutually exclusive.  P2STRING supports
  189.       either multi-threaded or multi-process execution, but not both.
  190.  
  191.   o   @SET_EVENT "name" 0|1
  192.  
  193.       Used to set event "name" to either 1 (for SET), or  0  (for  CLEAR).
  194.       The event must have been declared via the @EVENTS directive.
  195.  
  196.   o   @WAIT_EVENT "name" "[time-out]"
  197.  
  198.       Wait  until  event "name" is set to 1.  The "time-out" is specified in
  199.       milliseconds.  If omitted, it defaults to 3 minutes.
  200.  
  201.       NOTE:  Timing out on a @WAIT_EVENT is NOT considered a failure.
  202.  
  203.   o   @WAIT_NOTIFY "number" "[time-out]"
  204.  
  205.       Wait for a specific expected MM_MCINOTIFY  labled  "number".  Please  see
  206.       Section 4,  "Multi-Thread  Multi-Process  Testing."  on  page 11 for more
  207.       information.
  208.  
  209.       The "time-out" is specified in milliseconds.  If omitted, it defaults to  3
  210.       minutes.
  211.  
  212.       If  the  associated  mciSendString  fails, the event is posted to prevent
  213.       delays for notifications that are never going to be sent.
  214.  
  215.       NOTE:  Timing out on a @WAIT_NOTIFY is NOT considered a failure.
  216.  
  217.   o   @WAIT_PASSDEVICE "alias" "[time-out]"
  218.  
  219.       Wait until the device instance with an alias of "alias" gains  use.  This
  220.       assumes  that  the  alias  names  used  within a script are unique.  The
  221.       maximum alias name length is 20 characters.
  222.  
  223.       The "time-out" is specified in milliseconds.  If omitted, it defaults to  3
  224.       minutes.
  225.  
  226.       The tool assumes that a unique alias is specified on each open...  string
  227.       command.    If  unique  aliases are not used, errors conditions of "Event
  228.       already posted" may occur.
  229.  
  230.   o   @REM "comment"
  231.  
  232.       Echos  "comment" to  the screen and the output log file.  All other script
  233.       comment lines (those starting with ";" or "#") are  not  transferred  nor
  234.       displayed.
  235.  
  236.   o   @PAUSE "time-out"
  237.  
  238.       Pauses  processing  of  the current thread or process in the input script
  239.       file for the specified time.   It does not stop  the  processing  of  the
  240.       notifications  or  window functions.   Other threads or processes are not
  241.       effected by this directive.
  242.  
  243.   o   @BREAK "[message]"
  244.  
  245.       Causes a message box to pop-up and  stops  the  input  script  processing
  246.       until  user  reponds.    The optional message is displayed in the box and
  247.       can be used as a prompt to the operator, eg. "replace the CD".
  248.  
  249.   o   @CHECK "[message]"
  250.  
  251.       This directive will grade the success of the previous  command  based  on
  252.       the  user's response.  A pop-up will display the "message" and offer
  253.       Yes and No button.  The status is passed if user selects Yes,  or  failed
  254.       if No is selected.  For example:
  255.  
  256.            @BREAK The music will play for 5 secs. Get ready to time it.
  257.            play cdaudio notify
  258.            @PAUSE 5000
  259.            @CHECK Did it play?
  260.  
  261.  
  262.   3.3  MMPM/2 STRING COMMANDS
  263.   ___________________________
  264.  
  265.   All lines that don't fall into any of the other categories are interpreted as
  266.   MMPM/2  string  commands.    These  lines are passed to MDM via MCISENDSTRING
  267.   after environment variable substitution.
  268.  
  269.   Any tokens in the string command line bracketed by question marks (eg. ?FOO?)
  270.   is interpreted as an environment variable.  The actual value of the  environ-
  271.   ment  variable  will  be  substituted  into the string before it is passed to
  272.   mciSendString.  If the variable is not found, a warning  is  issued  and  the
  273.   token  is replaced with a null string.  For example, assuming the environment
  274.   string MMDATA is set to D:\DATA, then  the  command  "open  ?mmdata?\temp.wav
  275.   alias a" is equivalent to "open d:\data\temp.wav alias a".
  276.  
  277.  
  278.   3.4  EXPECTED RETURN STRINGS
  279.   ____________________________
  280.  
  281.   Many  MMPM/2  commands return strings.  It is possible to check these strings
  282.   against an expected value with an expected return string line.
  283.  
  284.   An expected return string line has the format: "=result".  The "=" must be in
  285.   column 1 and should have no trailing spaces.  If an empty string is expected,
  286.   nothing should follow the "=" (not even spaces).  For example:
  287.  
  288.        status cdaudio ready wait
  289.        =TRUE
  290.        status cdaudio mode wait
  291.        =stopped
  292.  
  293.   The  expected  result  is  always  always interpreted as a string.   This may
  294.   produce some strange outputs for any commands that returns binary data.
  295.  
  296.   Where the return is a textual numerical value, it may be matched to a  toler-
  297.   ance  range  of +/- 10% using a tilde ("&tilde.") before the number.  This is
  298.   typically used when the exact value cannot be known.  For example:
  299.  
  300.        set foo time format milliseconds wait
  301.        play foo notify
  302.        @PAUSE 1000
  303.        stop foo wait
  304.        status foo position wait
  305.        =&tilde.1000
  306.  
  307.   Thus, the status command will be considered successful if the returned string
  308.   is in the range 900-1100.
  309.  
  310.  
  311.   3.5  EXPECTED ERRORS
  312.   ____________________
  313.  
  314.   When an MMPM/2 string command is expected to fail with an error, use the  the
  315.   expected  error  line to specify the error expected.  The expected error line
  316.   has the format:  "=!error".  The "=!'  must start in column 1. If  any  error
  317.   is  acceptable,  then  use  the  keyword  "ERROR".    If  a specific error is
  318.   expected, enter the exact error message after the "=!".  For example:
  319.  
  320.        open sequencer alias mymidi wait
  321.        load mymidi nofile.foo
  322.        =!File not found.
  323.  
  324.   Be careful about extra blanks in  the  expected  error  and  expected  result
  325.   lines.    The case of the strings is unimportant, however the comparison will
  326.   fail if the spacing or punctuation does not match exactly.
  327.  
  328.  
  329.   3.6  EXPECTED NOTIFIES
  330.   ______________________
  331.  
  332.   Many MMPM/2 string commands will cause notification messages to  be  sent  to
  333.   the  tool.    It  is  possible  to  verify  that the proper notifications are
  334.   received via an expected notify line.  Each expected notification  line  will
  335.   begin  with  a  "+" in column 1.   Three types of notification lines are pos-
  336.   sible: command completion/error notifications, event notifications, and posi-
  337.   tion change notifications.  Any or all may be expected for  a  single  MMPM/2
  338.   string command.  These are detailed below:
  339.  
  340.   o   +MM_MCINOTIFY  notify-code message [#number]
  341.  
  342.       notify-code    This    is    the    notification    message   code,   eg.
  343.                      MCI_NOTIFY_SUCCESSFUL.  The spelling should be the same as
  344.                      the #defines in the os2me.h for the notify codes.
  345.  
  346.       message        The  MCI  message  that  caused  the   notification,   eg.
  347.                      MCI_PLAY.  The spelling should be the same as the #defines
  348.                      in the os2me.h for the MCI messages.
  349.  
  350.       number         The   number   is   a   unique  lable  used  to  associate
  351.                      @WAIT_NOTIFY  directives  with  particular  notifications.
  352.                      This  number  has  nothing  to  do with the order in which
  353.                      strings are sent.  The number must be unique  and  in  the
  354.                      range  1-99.    Please see Section 4, "Multi-Thread Multi-
  355.                      Process Testing." on page 11 for more information.
  356.  
  357.   o   +MM_MCIPOSITIONCHANGE position %user-parameter #number
  358.  
  359.       position       The expected MMTIME position of the first position  change
  360.                      message.
  361.  
  362.       user-parameter The  user  parameter  to  be returned - this should be the
  363.                      same as specified as the RETURN value in SETPOSITIONADVICE
  364.                      send string.  Note that return value should be  an  unique
  365.                      integer in the range of 1 - 99.
  366.  
  367.       number         The number of position change messages expected.
  368.  
  369.       For   more   information,   please   see   Section 6,   "Limitations   of
  370.       MM_MCIPOSITIONCHANGE Verification" on page 15.
  371.  
  372.   o   +MM_MCICUEPOINT position %user-parameter
  373.  
  374.       The parameters position and user-parameter are the same as above.
  375.  
  376.   NOTE:  Other notification messages can not be compared because  they  do  not
  377.   allow  for  a UserParameter as part of the message which is essential for the
  378.   tracking of related notifications.
  379.  
  380.  
  381.  
  382.   SECTION 4.  MULTI-THREAD MULTI-PROCESS TESTING.
  383.   _______________________________________________
  384.  
  385.  
  386.   Thread/Process  testing  is mutually exclusive.  Thread/Process blocks can be
  387.   layed out in any order within the script.  The tool preprocesses  the  script
  388.   and  builds  process command buffers.   Each command is uniquely marked by an
  389.   index which represents the command order in the entire script, not within its
  390.   thread block.   This key is used as  the  user  parameter  with  notification
  391.   callback  handle.    Use this key to track the return codes and notifications
  392.   for a string command.  Tool output represents the chronological order of exe-
  393.   cution of the commands from all the threads and processes.  There is a  small
  394.   chance  of  that order being disturbed by i/o scheduling of the threads, when
  395.   they request the file logging at the same time.   In case  of  multiprocessed
  396.   testing,  parent  process  performs all the preprocessing, initialization and
  397.   status report.  Children processes are spawned during the initialization  but
  398.   released  (via  a semaphore) only when everything is ready for the execution.
  399.   Concurrent execution of the processes is not enforced by  the  tool,  and  if
  400.   needed  can  be  specified  by the script writer.  The parent is always ready
  401.   before all the children are and therefore, it can  post  a  script  event  on
  402.   which  all  the  children processes are waiting.  The processes are closed at
  403.   ExitListProcedure time.
  404.  
  405.   In case of threads, all the threads are concurrently executed.
  406.  
  407.   EVENTS have two states (1,0).  1 is used to mark that event has happened.   0
  408.   is  used  to reset the event.  Waiting on the event means wait until somebody
  409.   marks the event as happened (1).  If the event is in state 1, setting  it  to
  410.   state  0  is  the only meaningful operation.   WAIT would in this case return
  411.   immediately.  If event is in state 0, SET to 0 would also make no difference,
  412.   but WAIT would wait until someone sets the event to 1. WAIT doesn't  cause  a
  413.   change  of the event state.  @WAIT_NOTIFY number must match the index used in
  414.   the MM_MCINOTIFY reference line.   The WAIT_NOTIFY events  are  not  reusable
  415.   because  there is no events that logically resets it.  If you need a reusable
  416.   event, opt for WAIT_EVENT.  @WAIT_PASSDEVICE events are keyed  by  the  alias
  417.   names and these should be unique across the script.
  418.  
  419.   Remark:    The  assumed thread number from the start of the script body is 1.
  420.   Maximum size of the display buffer is 500 lines per process.  If the  display
  421.   requires  more  than  this,  the  window will wrap-up and the first 500 lines
  422.   can't be scrolled thru, once passed.  Maximum number of wait events 100, pass
  423.   device 10, notify events 100.  The tool has a low-tolerance parsing.  All  of
  424.   the string comparisons will fail if entire strings are not equal.  It doesn't
  425.   tolerate  multiple  blanks or tabs.   Aliases used in @WAIT_PASSDEVICE direc-
  426.   tives should match cases with real instance aliases.    Maximum  string  line
  427.   should  not  exceed  170  characters.    The tool will exit if this condition
  428.   fails.  The tool doesn't allow multiple copies being  executed  at  the  same
  429.   time.  The size of the stack for each thread is 64K.  The size of the message
  430.   queues for all window threads is 100.
  431.  
  432.   P2STRING   tool   consists   of   an  executable  (P2STRING.EXE)  and  a  DLL
  433.   (P2S_DLL.DLL).
  434.  
  435.  
  436.  
  437.   SECTION 5.   PROCESSING LOGIC
  438.   _____________________________
  439.  
  440.  
  441.   A  string  command line can be followed by zero to one return value lines, or
  442.   zero to three notification lines.  Note that this is an exclusive OR, meaning
  443.   that specifying both expected return value and expected notification  is  not
  444.   going  to  give reliable results due to the fact that returned buffer doesn't
  445.   become valid prior to the end of the notify message.  Also in case of  notify
  446.   flags,  return  values  are in the PROCEDURAL INTERFACE format rather than in
  447.   the STRING INTERFACE format.
  448.  
  449.   The MDM will not be able to convert return values  to  strings  for  commands
  450.   executed  with  the  notify  flag  because  MCI drivers will be sending their
  451.   notify messages directly to the application.
  452.  
  453.   Status of each command is determined in two stages. First stage is at  string
  454.   execution.  If mciSendString returns an error and there was no =!ERROR refer-
  455.   ence line in the script following the command string line, command is consid-
  456.   ered as failed. If a return value was found after mciSendString is  executed,
  457.   the tool will check for expected return and perform comparison of the two. It
  458.   they  do  not match, the command is considered as failed. In case of an error
  459.   that is not in the range understood by the mciGetErrorString API, the command
  460.   is considered failed even if the !ERROR was encountered.
  461.  
  462.   Second stage of the comparison is after a notification is received and  after
  463.   all  the commands were issued. If a notification was received and it success-
  464.   fully compared to the expected notification line, the command  is  considered
  465.   successful.  If  there  was  no  reference  notification  line, status of the
  466.   command will not be assigned, unless notify-error was returned.    After  all
  467.   the  scripts  are processed, expected reference notifications will be used to
  468.   determine if all the notifications were received. The commands that  did  not
  469.   receive  a  notify  and had an expected notification line of the type will be
  470.   marked as failed. Note that command strings are not examined for presence  of
  471.   "notify"  flag  and  it  is the writer's responsibility to create an expected
  472.   notify line if it is of importance. In  case  of  expected  notify_successful
  473.   messages,  all  codes  other  than  notify_error  are  considered valid. This
  474.   includes notify_successful,  notify_aborted  and  notify_superceded.  If  any
  475.   other  notify code was specified as expected, and exact match will be checked
  476.   for. If NOTIFY_ERROR is expected, all errors in the  range  are  verified  as
  477.   passed. There is no facility for verification of an exact error code returned
  478.   in the notification.
  479.  
  480.  
  481.  
  482.   SECTION 6.  LIMITATIONS OF MM_MCIPOSITIONCHANGE VERIFICATION
  483.   ____________________________________________________________
  484.  
  485.  
  486.   Verification  of  MM_MCIPOSITIONCHANGE  messages  is  limited in the P2STRING
  487.   tool.  It requires usage of the "RETURN UserParameter" options in the respec-
  488.   tive strings.  It also doesn't provide for timing start point (eg.    playing
  489.   has  started  or  similar).    The tool can only count the number of messages
  490.   received for a specific UserParameter (used as a key) and check if subsequent
  491.   messages have positions approximate the  given  expected  position  interval.
  492.   The   script   writer   has   the  responsibility  to  premeditate  how  many
  493.   positionadvice messages are expected, taken  into  account  the  duration  of
  494.   playing,  time  format  and start position of the play/record.  The reference
  495.   POSITION given in the expected notification line must be in MMTIME (since the
  496.   MM_MCI..  message returns the same format).  If expected number  of  messages
  497.   parameter  is omitted, the tool will not verify the number, just the position
  498.   interval.  In case of scripts where play/seek/record are used to  cover  non-
  499.   monotonic ranges, the tool may report failures on position-advises because it
  500.   expects each positionadvise to be in the next position interval from the pre-
  501.   vious message.  If the script makes a jump to a position that doesn't conform
  502.   to this, the status will be logged as failed.
  503.  
  504.   For example:
  505.  
  506.        setpositionadvise SomeDevice every 10000 on return 5
  507.        +MM_MCIPOSITIONCHANGE 10000 %5
  508.        play SomeDevice from 35000 to 55000 notify (will produce 3 positionchange messages)
  509.        seek SomeDevice to 30000 wait
  510.        play SomeDevice notify ( will produce a number of messages starting at 30000)
  511.  
  512.   PositionChange  messages  are logged as failed, because of the lapse in posi-
  513.   tion interval.
  514.  
  515.   A way to handle this situation is to disable  the  positionchange  before  an
  516.   explicit position jump is made and enable the same positionadvise with a dif-
  517.   ferent user parameter.
  518.  
  519.   For Example:
  520.  
  521.        setpositionadvise SomeDevice every 10000 on return 5
  522.        +MM_MCIPOSITIONCHANGE 10000 %5
  523.        play SomeDevice from 35000 to 55000 notify (will produce 3 positionchange messages)
  524.        setpositionadvise SomeDevice every 10000 off
  525.        seek SomeDevice to 30000 wait
  526.        setpositionadvise SomeDevice every 10000 on return 6
  527.        +MM_MCIPOSITIONCHANGE 10000 %6
  528.        play SomeDevice notify ( will produce a number of messages starting at 30000)
  529.  
  530.  
  531.  
  532.   SECTION 7.  ADDITIONAL CONSIDERATIONS
  533.   _____________________________________
  534.  
  535.  
  536.   P2STRING  allows  for  variable  number  of  lines for display in its window.
  537.   Regular comment lines (header lines) are not displayed  nor  written  to  the
  538.   output file.
  539.  
  540.   If input file can't be opened, the execution is terminated.
  541.  
  542.   The tool will attempt to allocate memory for its display and internal buffers
  543.   and  will  not  proceed  if  it fails to obtain all of its memory at the very
  544.   beginning of its execution.  It allocates 3 notification  buffers,  2  status
  545.   buffers,  1 return value buffer, n command buffers (threads/processes), and a
  546.   display buffer whose size is estimated based on the number of  lines  in  the
  547.   first  input file.  In case of a script with bigger display requirements than
  548.   what was estimated and allocated, the display screen may wrap up and lose the
  549.   first half of the screen (scrolling back will stop at the line which  had  to
  550.   wrap  up).  However, this does not disrupt the logging to the output file and
  551.   should not be a major inconvenience.  In cases where this is unacceptable,  a
  552.   work-around  is to add more comment lines to the main script.  The tool esti-
  553.   mates that each line of input takes 5 lines of output.
  554.  
  555.   The tool is a multithreaded program and its window can be manipulated even if
  556.   a "wait" string command is in progress.  If the window is closed, the  string
  557.   execution  thread  is  immediately killed and entire process terminated.  The
  558.   termination closes all of the open files and destroys both message queues and
  559.   performs WinTerminate before it issues DosExit.   In case  of  multi-threaded
  560.   execution, the main script processing thread spawns n (@THREADS=n) threads in
  561.   suspended mode during the initialization and resumes them at the time of exe-
  562.   cution.  That means that during the execution there are n+2 P2STRING threads.
  563.   In  case  of  multi-process  execution, the tool prepares all the buffers and
  564.   spawns (n-1) processes (@PROCESSES=n).  The processes are signaled to execute
  565.   at the end of pre-processing.   The parent process executes  its  buffer  and
  566.   then  waits  for  all of the children.  At the time of execution, there are n
  567.   processes with 2 threads each.  Each process logs to its own display  window,
  568.   but all processes log to the same output and debug files.
  569.  
  570.  
  571.  
  572.   APPENDIX A.  SAMPLE SCRIPT
  573.   __________________________
  574.  
  575.  
  576.   A  sample  script  file, called sample.scr, has been placed in this directory
  577.   for your use.  Please refer to that file for examples on the use of  P2STRING
  578.   syntax and directives, etc.
  579.  
  580.  
  581.  
  582.   APPENDIX B.   SAMPLE OUTPUT
  583.   ___________________________
  584.  
  585.  
  586.   The sample script file, sample.scr, creates an output file called sample.out.
  587.   This  file has also been placed in this directory for your use.  Please refer
  588.   to sample.out for an example of the type of output created by P2STRING.
  589.  
  590.  
  591.  
  592.   APPENDIX C.  A NOTE ABOUT ALIASES
  593.   _________________________________
  594.  
  595.  
  596.   The tool preprocess the script and creates list of aliases that are tracked.
  597.  
  598.   For  every received gaining or losing use message, the tool determines if the
  599.   Device ID corresponds to one of  the  tracked  aliases  and  posts/reset  the
  600.   appropriate  event.   If an alias is re-used, the tool will handle the change
  601.   in the Device ID's.  However, in case where the same alias is used twice  and
  602.   happened to be given the same Device ID by the MDM, the losing use message is
  603.   the  only  way  to clear the event.  So if no losing use message was received
  604.   for the alias, the tool  can't  detect  that  alias  now  addresses  a  fresh
  605.   instance and may return "Event already posted".  The recommendation is to use
  606.   unique aliases for the scripts that are taking advantage of this directive.
  607.  
  608.   NOTE:  use a unique alias for every OPEN command.!!!!
  609.