home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / top2src.zip / EPI.TXT < prev    next >
Text File  |  1996-11-10  |  8KB  |  205 lines

  1. EPI Structure
  2.  
  3. Opcodes are a series of words corresponding to the No. field of the command
  4. below.  All other values are also words unless otherwise indicated.
  5.  
  6. Numerical data is compiled as follows:
  7.  
  8. <type> <index/value>
  9.  
  10. <type> specifies what <index/value> will be, one of the following:
  11.  
  12.     0 - Variable index.
  13.     1 - Short (1-word) value.
  14.     2 - Long (2-word) value.
  15.  
  16. If the requirement is constant, then <type> is omitted and the meaning of
  17. <index/value> is assumed as needed.
  18.  
  19. All numeric data is assumed to be unsigned.
  20.  
  21. String data is compiled as follows:
  22. <type> <index/length> [<string data>]
  23.  
  24. <type> specifies what <index/length> will be, one of:
  25.  
  26.     0 - Variable index.
  27.     1 - String value length.
  28.  
  29. If <type> is 1, then <string data> is the actual string data (1 char per byte),
  30. padded with an ASCII 0 to supply an even number of characters, if needed.
  31.  
  32. If the requirement is constant, then <type> is omitted and the meaning of
  33. <index/length> is assumed.  If the assumption is type 1 then <string data>
  34. follows (0-padded if needed).
  35.  
  36. In memory, string variables are stored as:
  37.  
  38. <length> <string data>
  39.  
  40. Fields are the same as above.
  41.  
  42. Code indexes are stored as a long (double word) and indicate the offset number
  43. of words from the start of the program.
  44.  
  45. Boolean types are the same as numeric types, where !0 = TRUE and 0 = FALSE.
  46.  
  47. EPI Variable Types
  48.  
  49. 0   INT         Short (1-word) integer.
  50. 0   SHORT       Short (1-word) integer.
  51. 1   LONG        Long (2-word) integer.
  52. 2   BOOL        Short (1-word) integer with TRUE/FALSE compile-time checking.
  53. 3   STRING(X)   String variable of X characters.  (X) = (255) if omitted.
  54.  
  55. EPI Programs
  56.  
  57. Programs consist of multiple statements, one per line.  Statements can be
  58. generalized as follows:
  59.  
  60. <command> <params>
  61.  
  62. <command> is a command word from below.  <params> are the required
  63. parameter(s), if any, for that command word, according to the chart below.
  64.  
  65. Labels take the following form:
  66.  
  67. :<name>
  68.  
  69. <name> is the name of the label.  The colon specifies where the label actually
  70. points to and is not needed for references.
  71.  
  72. All variable names and label names are limited to 30 characters or less.
  73.  
  74. EPI Compilation
  75.  
  76. Compilation is linear, one pass compilation.  Each line is read and compiled
  77. sequentially on each pass.
  78.  
  79. All lines are read and processed.  Comments are ignored.  Variable declarations
  80. are processed and allocators are written to the output file in this format:
  81.  
  82. <type> <info>
  83.  
  84. Type is a number from the variable type chart above.  <info> depends on the
  85. variable type.  For strings it is the buffer length, and for numeric variables
  86. it is the default value, or 0.  (Note that longs can only be initialized in
  87. short range.)
  88.  
  89. Variable names and indexes are stored in memory so the program may refer to
  90. them.,,,,,,,,,,,,,,,,,
  91.  
  92. Labels are read and their names
  93.  
  94. EPI Commands (simple format)
  95.  
  96. No.    Command Word  Params
  97.       Description
  98. -------------------------------------------------------------------------------
  99.     0  ADD           <var> [<amount>]
  100.       Adds <amount> (1) to <var> and stores result in <var>.
  101.     0  INC           <var>
  102.       Synonym for ADD <var> 1.
  103.     1  SUB           <var> [<amount>]
  104.       Subtracts <amount> (1) from <var> and stores result in <var>.
  105.     1  DEC           <var>
  106.       Synonym for DEC <var> 1.
  107.     2  MUL           <var> <amount>
  108.       Multiplies <var> and <amount> and stores result in <var>.
  109.     3  DIV           <var> <amount>
  110.       Divides <var> by <amount> and stores result in <var>.  Mod is discarded.
  111.     4  MOD           <var> <var> <amount>
  112.       Divides <var2> by <amount>, stores remainder in <var1>, discards quo.
  113.     -  CALC          <var> <math exp>
  114.       Calculates a math expression (+-*/%) and stores result in <var>.
  115.       Compiles to an ASSIGN followed by a bunch of math ops, all operating on
  116.       <var>.
  117.     5  CALL          <code index>
  118.       Calls function residing at <code index>.
  119.     6  SHELL         <string>
  120.       Shells to DOS and executes the command in <string>.
  121.     7  JUMP          <code index>
  122.       Changes program execution location to <code index>.
  123.     7  RETURN
  124.       Returns from last function.  Translates to JUMP with popped code index.
  125.     8  LOOP          <var> <amount> <amount> [<amount>]
  126.       Counts <var> from <amount1> to <amount2> in steps of <amount3> (1).
  127.     9  ENDLOOP
  128.       Ends the last loop.
  129.    10  ASSIGN        <var> [<amount>]
  130.       Sets <var> to <amount> (0).
  131.    10  ZERO          <var>
  132.       Same as ASSIGN <var> 0.
  133.    11  SET           <var> [<string>]
  134.       Sets string variable <var> to <string> ("").
  135.    11  CLEAR         <var>
  136.       Same as SET <var> "".
  137.    12  CONCAT        <var> <string>
  138.       Adds <string> to the end of <var> and stores result in <var>.
  139.    13  COMPARE       <var> <var> <string>
  140.       Compares <var2> and <string> and stores result in <var1>.
  141.    14  FIND          <var> <var> <string>
  142.       Looks for <string> in <var2> and stores result in <var1>.
  143.    15  OUTPUT        <string> <dest> [<var>] <param var[s]>
  144.       Prints <string> to <dest> (SCREEN), opt. store in <var> and using <param
  145.       vars> to fill @# tokens.
  146.    16  FILTER        <string> [<string>]
  147.       Filters PubColour codes from <string1>, storing the result in <string2>
  148.       (<string1>).
  149.    17  TRIM          <var> <string> [<string>]
  150.       Trims <string1> of spaces by <var> method, storing the result in
  151.       <string2> (<string1>).
  152.    17  LEFTTRIM      <string> [<string>]
  153.       Synonym for TRIM TRIM_LEFT <string> [<string>].
  154.    17  RIGHTTRIM     <string> [<string>]
  155.       Synonym for TRIM TRIM_RIGHT <string> [<string>].
  156.    17  FULLTRIM      <string> [<string>]
  157.       Synonym for TRIM TRIM_ALL <string> [<string>].
  158.    18  CLIP          <string> <var>
  159.       Clips <string> to <var> characters.
  160.    19  EXTEND        <string> <var> [<var>]
  161.       Extends <string> to <var1> characters, filling with <var2> (32).
  162.    20  OUTLANG       <string> <dest> [<var>] <param var[s]>
  163.       Like OUTPUT but <string> is the name of a language item.
  164.    21  RANDOM        <var> <amount>
  165.       Generates a random number from 0 to <amount>-1 and assigns it to <var>.
  166.   100  SETTIME       <amount>
  167.       Sets a user's remaining time to <amount> minutes.
  168.   101  ADDTIME       <amount>
  169.       Adds <amount> minutes to the user's remaining time.
  170.   102  SUBTIME       <amount>
  171.       Subtracts <amount> minutes from the user's remaining time.
  172.   103  SETSEC        <amount>
  173.       Sets a user's TOP security level to <amount>.
  174.   104  SETHANDLE     <var>
  175.       Sets a user's TOP handle to <var>.
  176.   500  CARDINIT      <var> <amount> <boolean>
  177.       Initializes a set of cards containing <amount> decks, assigning the index
  178.       to <var>, or 0 for failure.  If <boolean> is true, each deck will be
  179.       treated as if it had jokers, with 54 slots for cards per deck.
  180.       Otherwise, the deck(s) will contain 52 slots.  Programs are free to treat
  181.       the cards in any way they like, though the standard identifications
  182.       (given by CARDNAMES) are recommended.
  183.   501  CARDSHUFFLE   <var>
  184.       Shuffles a set of cards, index <var>.  This takes all of the discarded
  185.       cards in the deck and marks them as available again.  It does not touch
  186.       removed cards.
  187.   502  CARDDEAL      <var> <var> [<var>]
  188.       Picks card <var3> (-1 (random)) from set index <var2> and stores it in
  189.       <var1>, or stores 0 if the card is not available.
  190.   503  CARDDISCARD   <var> <var>
  191.       Discards card <var1> from set index <var2>.
  192.   504  CARDREMOVE    <var> <var>
  193.       Removes card <var1> from play from set index <var2>.  Removed cards can
  194.       only be brought back into play using CARDRESET.
  195.   505  CARDRESET     <var>
  196.       Resets set index <var> completely, marking ALL cards available again.
  197.   506  CARDCLOSE     <var>
  198.       Removes set index <var> from circulation, making it free to be used
  199.       again.
  200.   507  CARDNAMES     <var>
  201.       Returns a 108 character string containing the standard 54 two-character
  202.       strings (AS, 2S, 3H, etc.) to identify cards, storing it in <var>.  This
  203.       string comes from the language file, and can be changed by sysops.
  204.  
  205.