home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / apl2 / aplsvi.h__ / aplsvi.h
Encoding:
C/C++ Source or Header  |  1993-12-15  |  7.3 KB  |  167 lines

  1. /*-m-aplsvi----------------------------------------------------------
  2.  *
  3.  * Module Name: aplsvi.h
  4.  *
  5.  * Descriptive Name: Shared Variable Interpreter
  6.  *
  7.  * Copyright:   APL2/6000               Version 1.2
  8.  *              APL2 for OS/2           Version 1.0
  9.  *              APL2 for Sun Solaris    Version 1.0
  10.  *              Licensed Materials - Property of IBM
  11.  *              (C) COPYRIGHT IBM CORP. 1994
  12.  *
  13.  * Function:    Define constants used in communicating with an APL
  14.  *              session, when the using partner is acting as a
  15.  *              session manager.  The constants defined here are
  16.  *              used in data fields within CDRs for variables shared
  17.  *              with the interpreter itself.
  18.  *
  19.  * Notes:
  20.  *
  21.  *    Dependencies: None
  22.  *
  23.  *    Restrictions: None
  24.  *
  25.  * Module Type: Header
  26.  *
  27.  * Change Activity:
  28.  *
  29.  *-Z----------------------------------------------------------------*/
  30.  
  31. /**********************************************************************/
  32. /*                                                                    */
  33. /*                     Interpreter output                             */
  34. /*                                                                    */
  35. /* Using the shared variable interface, the interpreter sends         */
  36. /* messages and arrays through the APL2 variable as 3 item arrays.    */
  37. /* The first item is an integer scalar return code.                   */
  38. /*                                                                    */
  39. /* If the return code is positive, then it and the rest of the array  */
  40. /* is defined as QuadEC output.  The only case currently implemented  */
  41. /* is a return code of 1. The second item will be a two element       */
  42. /* integer QuadET code (currently always 0 0), and the third item     */
  43. /* will contain the output data.  This may be formatted as character  */
  44. /* vectors or may be arbitrary APL arrays, depending on the output    */
  45. /* setting.                                                           */
  46. /*                                                                    */
  47. /* If the return code is -1, the rest of the array defines either a   */
  48. /* special class of output, or is an input request.  The second item  */
  49. /* is a 2 element integer vector.  Its first element indicates what   */
  50. /* type of output is being sent, or what type of prompt is            */
  51. /* requested.  The second element of the second item is 0 if this     */
  52. /* output completes a line, or 1 if it is an input prompt or more     */
  53. /* data may follow for the same line.  The third item contains any    */
  54. /* output data.                                                       */
  55. /*                                                                    */
  56. /* If the return code is -2, the second item is 0 0 and the third     */
  57. /* item is a 5-element vector, containing the current values of       */
  58. /* QuadPW, QuadPP, PBS, QuadPR, and QuadFC.  The first three are      */
  59. /* integer scalars (PBS is always 0), and the last two are character  */
  60. /* vectors.  These are sent at the beginning of the APL session and   */
  61. /* whenever any of them is modified.                                  */
  62. /*                                                                    */
  63. /* If the return code is -3, the second item is 0 0 and the third     */
  64. /* item is a character vector containing a line from the AP 101       */
  65. /* stack.  This line is sent immediately before requesting input,     */
  66. /* and should normally be returned in response to the following       */
  67. /* input prompt.                                                      */
  68. /*                                                                    */
  69. /**********************************************************************/
  70.  
  71. /*
  72.  *  Return code values
  73.  */
  74. #define APLRC_NORMAL              1
  75. #define APLRC_MESSAGE            -1
  76. #define APLRC_QUADS              -2
  77. #define APLRC_STACK              -3
  78.  
  79. /*
  80.  * Message types (when return code == APLRC_MESSAGE)
  81.  */
  82. #define APLMTYP_SYSTEM_MESSAGE    0
  83. #define APLMTYP_APL_PROMPT        1
  84. #define APLMTYP_QUAD_PROMPT       2
  85. #define APLMTYP_FUNCTION_PROMPT   3
  86. #define APLMTYP_FUNCTION_LINE     4
  87. #define APLMTYP_FUNCTION_STAMP    5
  88. #define APLMTYP_FUNCTION_NAME     7
  89. #define APLMTYP_ERROR_MESSAGE     8
  90. #define APLMTYP_SYSTEM_COMMAND    9
  91. #define APLMTYP_TRACED_RESULT    10
  92. #define APLMTYP_QUAD_OUTPUT      11
  93. #define APLMTYP_QQUAD_OUTPUT     12
  94. #define APLMTYP_DEBUG_OUTPUT     13
  95. #define APLMTYP_QQUAD_PROMPT     14
  96.  
  97. /*
  98.  * Quad variable item indices (when return code == APLRC_QUADS)
  99.  */
  100. #define APLITEM_QUAD_PW           0
  101. #define APLITEM_QUAD_PP           1
  102. #define APLITEM_QUAD_PR           3
  103. #define APLITEM_QUAD_FC           4
  104.  
  105. /**********************************************************************/
  106. /*                                                                    */
  107. /*                     Requests to the interpreter                    */
  108. /*                                                                    */
  109. /* The following requests may be sent either through the session      */
  110. /* APL2 variable or some other variable shared with the APL2          */
  111. /* interpreter.  Each request is sent as a vector containing two or   */
  112. /* more items.  The first item is always an integer identifying the   */
  113. /* request class, and the second an integer identifying a request     */
  114. /* type within the class.                                             */
  115. /*                                                                    */
  116. /* Classes 0 and 1 are signal codes.  There is no explicit response   */
  117. /* to them.                                                           */
  118. /*                                                                    */
  119. /* Class 0 controls execution, and includes things like               */
  120. /* attention signals.                                                 */
  121. /*                                                                    */
  122. /* Class 1 controls session output.                                   */
  123. /*                                                                    */
  124. /**********************************************************************/
  125.  
  126. /*
  127.  * Execution Control Signal Codes
  128.  *
  129.  * 0 0    Do nothing.
  130.  *
  131.  * 0 1    Send a weak attention signal (stop at end of line).
  132.  *
  133.  * 0 2    Send a strong interrupt signal (stop as soon as possible).
  134.  *
  135.  * 0 3    Suppress output until the next input request.
  136.  *
  137.  * 0 4    Shut down the APL2 session.
  138.  */
  139.  
  140. #define APLRQ_EXEC                0
  141.  
  142. #define APLRQ_EXEC_NOOP           0
  143. #define APLRQ_EXEC_ATTENTION      1
  144. #define APLRQ_EXEC_INTERRUPT      2
  145. #define APLRQ_EXEC_SUPPRESS       3
  146. #define APLRQ_EXEC_SHUTDOWN       4
  147.  
  148. /*
  149.  * Output Control Signal Codes
  150.  *
  151.  * 1 0    Send future array output as unformatted arrays, i.e.  as if
  152.  *        the result of the APL statement were assigned to the 3rd item
  153.  *        of the shared variable.
  154.  *
  155.  * 1 1    Send array output formatted, one line at a time, as if
  156.  *        displaying it on a line-oriented output device.
  157.  *
  158.  * 1 2 n  Send array output formatted, but multiple lines at a time, as
  159.  *        a vector of character vectors.  From 1 to n are sent at a time.
  160.  */
  161.  
  162. #define APLRQ_OUT                 1
  163.  
  164. #define APLRQ_OUT_ARRAY           0
  165. #define APLRQ_OUT_LINE            1
  166. #define APLRQ_OUT_MULTILINE       2
  167.