home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TELIX.ZIP / SALT.DOC < prev    next >
Text File  |  1996-05-01  |  216KB  |  6,831 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.      T E L I X
  27.  
  28.      ─────────────────────────────────────────────────────────────────
  29.  
  30.      SALT Programming Manual
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.              Copyright (C) 1986-1996 by deltaComm Development, Inc.
  44.  
  45.  
  46.                               ALL RIGHTS RESERVED.
  47.  
  48.  
  49.  
  50.                            deltacomm Development, Inc.
  51.  
  52.                     P.O. Box 1185, Cary, NC   27512   USA
  53.  
  54.              (919)-460-4556 / (919)-460-4531 fax (919)-481-9399 BBS
  55.      Telix v3.5x - SALT Programming                         COPYRIGHT    ii
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                 COPYRIGHT NOTICE
  64.  
  65.  
  66.  
  67.      Telix is Copyright (c) 1986-1996 by deltaComm Development, Inc.
  68.  
  69.      This document is Copyright (c) 1988-1996 by deltaComm Development, Inc.
  70.  
  71.      No parts of Telix or this document may be copied in part or in whole,
  72.      except as provided in the License included with Telix.
  73.  
  74.  
  75.  
  76.  
  77.  
  78.                                    DISCLAIMER
  79.  
  80.      deltaComm Development, Inc., makes no warranty of any kind, either
  81.      express or implied, including but not limited to implied warranties of
  82.      merchantability and fitness for a particular purpose, with respect to
  83.      this software and accompanying documentation.
  84.  
  85.      IN NO EVENT SHALL DELTACOMM DEVELOPMENT, INC., BE LIABLE FOR ANY DAMAGES
  86.      (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
  87.      LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OUT OF THE
  88.      USE OF OR INABILITY TO USE THIS PROGRAM, EVEN IF DELTACOMM DEVELOPMENT,
  89.      INC., HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  90.  
  91.  
  92.      
  93.                                    TRADEMARKS
  94.  
  95.      Telix and SALT are trademarks of deltaComm Development, Inc.
  96.      Telix v3.5x - SALT Programming                         Contents    iii
  97.  
  98.  
  99.  
  100.      
  101.  
  102.                                  C O N T E N T S
  103.  
  104.  
  105.  
  106.      1.  The Telix SALT Language.....................................1
  107.      1.1  What Can be Accomplished With SALT?........................1
  108.      1.2  About This Manual..........................................1
  109.      1.3  Notation...................................................1
  110.      1.4  Creating SALT Programs.....................................1
  111.  
  112.      2.  Syntax......................................................3
  113.      2.1  Comments...................................................4
  114.  
  115.      3.  Program Structure...........................................5
  116.      3.1  Variables..................................................5
  117.      3.2  Expressions and Operators..................................7
  118.      3.3  Functions..................................................9
  119.      3.4  Statements................................................10
  120.        3.4.1  The Expression statement..............................11
  121.        3.4.2  The If statement......................................11
  122.        3.4.3  The While statement...................................13
  123.        3.4.4  The Do...While statement..............................13
  124.        3.4.5  The For statement.....................................14
  125.        3.4.6  The Return statement..................................15
  126.        3.4.7  The Break statement...................................15
  127.        3.4.8  The Continue statement................................16
  128.        3.4.9  The Goto statement....................................17
  129.  
  130.      4.  Built-in Functions.........................................19
  131.      4.1  Quick Listing of Functions by Type........................20
  132.      4.2  Complete Function Reference...............................22
  133.  
  134.      5.  System Variables...........................................97
  135.  
  136.      6.  Appendix A - ASCII Character Set..........................114
  137.      7.  Appendix B - Extended Key Scan Codes......................115
  138.      8.  Appendix C - Color Values.................................116
  139.      9.  Index.....................................................117
  140.  
  141.      Telix v3.5x - SALT Programming                       Introduction    1
  142.  
  143.  
  144.  
  145.  
  146.  
  147.      1.  THE TELIX SALT LANGUAGE
  148.  
  149.      Telix has a built-in programming language called SALT (Script Applica-
  150.      tion Language for Telix). SALT will allow you to perform almost any
  151.      communications related applications with Telix. SALT looks similar to
  152.      the C language, however if you have used almost any programming lan-
  153.      guage (such as Pascal, BASIC, etc.), you should feel quite at home
  154.      with SALT. While SALT was designed to be easy to learn, it is like
  155.      most programming languages quite complete, so it is recommended that
  156.      you read this chapter thoroughly and study the examples provided, as
  157.      well as the sample SALT scripts included with Telix.
  158.  
  159.  
  160.      1.1  What Can be Accomplished With SALT?
  161.      ──────────────────────────────────────────────────────────────────────
  162.  
  163.      Like a program in any programming language, a SALT program (also
  164.      called a 'script') is typically used to perform a needed task or func-
  165.      tion. The task can range from the very simple to the very complicated.
  166.      For example, a SALT script can be linked to a dialing directory entry,
  167.      so that when you have established a connection to that service, it au-
  168.      tomatically sends your i.d. and password to the remote service. A much
  169.      more complicated SALT script is used as the basis for the Host Mode
  170.      included with Telix.
  171.  
  172.  
  173.      1.2  About This Manual
  174.      ──────────────────────────────────────────────────────────────────────
  175.  
  176.      This manual is basically a reference to the SALT programming language.
  177.      It is by no means a tutorial on programming in general. It is assumed
  178.      that the reader of this manual is at least familiar with general pro-
  179.      gramming concepts.
  180.  
  181.  
  182.      1.3  Notation
  183.      ──────────────────────────────────────────────────────────────────────
  184.  
  185.      Throughout this manual, certain words in examples and in the text will
  186.      be surrounded by angle brackets and italicized, for example,
  187.      <expression>. These words are not to be taken as literal text. they
  188.      stand for something else, such as a word, a group of words, or even
  189.      several lines of text. What these italicized words stand for will be
  190.      explained as they come up.
  191.  
  192.  
  193.      1.4  Creating SALT Programs
  194.      ──────────────────────────────────────────────────────────────────────
  195.  
  196.      A SALT script is basically a sequence of instructions for Telix to
  197.      follow, using a specific syntax. You may use any text editor to pro-
  198.      duce this script file, as long as its output is normal ASCII text
  199.      (this means that if you use your word processor, you must usually ex-
  200.      plicitly tell it to write out the file using ASCII format and to not
  201.      embed any special codes in the file). You may give any name you wish
  202.      Telix v3.5x - SALT Programming                       Introduction    2
  203.  
  204.  
  205.  
  206.      to a SALT source file, although we recommend that you always use the
  207.      extension .SLT for clarity.
  208.  
  209.      Once you have written your script file and saved it to disk, it must
  210.      be compiled. The program CS.EXE included with Telix reads your
  211.      'source' script file, and compiles it to a form which Telix can under-
  212.      stand. The compiled script can then be loaded more quickly by Telix,
  213.      and is also usually smaller.
  214.  
  215.      To compile a script source file, type
  216.  
  217.           cs <pathname>
  218.  
  219.      while at the DOS prompt and then press Enter (or Carriage Return). The
  220.      CS.EXE program must be in the current directory or on the DOS PATH.
  221.      <pathname> is the name of the file to compile, and may include the
  222.      drive and directory as well as the filename. The output file is writ-
  223.      ten to the same name except that the extension .SLC is used.
  224.  
  225.      When the script compiler finds an error in your source file, it will
  226.      abort the compile process and give you the line number on which the
  227.      error occurred, as well as the type of error. The error should then be
  228.      fixed and the source re-compiled. This is repeated until the compiler
  229.      detects no more errors in your source file.
  230.  
  231.      The compiled script can then be run in Telix using several methods. It
  232.      may be run using the 'Run script' command, as a command-line option
  233.      when running Telix from DOS, as a linked script to a dialing directory
  234.      entry, or from another script. The first three methods are described
  235.      in the Telix manual, while the last is described later in this manual.
  236.      Telix v3.5x - SALT Programming                             Syntax    3
  237.  
  238.  
  239.  
  240.  
  241.  
  242.      2.  SYNTAX
  243.  
  244.      Case is not important in command, function, and variable names. The
  245.      only time case matters is inside a string constant (e.g., "Hello" is
  246.      not the same string as "hello"). Whitespace (such as the space, the
  247.      tab, the Carriage Return, or the Line Feed character) is not impor-
  248.      tant. The script compiler does not care where you place items, so that
  249.      you may arrange the program as you see fit. For example,
  250.  
  251.           if (value == 1)
  252.             prints("value is equal to 1!");
  253.           else
  254.             prints("values is not equal to 1.");
  255.  
  256.      is equivalent to
  257.  
  258.           if (value == 1) prints("value is equal to 1!");
  259.           else            prints("value is not equal to 1");
  260.  
  261.      or even to
  262.  
  263.           if(value==1)prints("value is equal to 1!");else prints("value is
  264.           not equal to 1.");
  265.  
  266.      The only time whitespace matters is when it would split up key-words
  267.      or function name, or in a string. For example, the key-word 'while'
  268.      must not be split up if it is to be recognized. The same applies to
  269.      other key-words or function names. As well, there must be space be-
  270.      tween the letters of a command and other letters. For example, 'while'
  271.      is not the same as 'whileabc'. In the interest of clarity, it is rec-
  272.      ommended that you try to make your code easy to understand, by indent-
  273.      ing where appropriate, and by using space effectively. There is no
  274.      reason, for example, to put more than one statement on a line, even if
  275.      it is perfectly legal. A good example of program style can be found by
  276.      looking at the sample scripts included with Telix.
  277.  
  278.      A string constant is a sequence of ASCII characters enclosed in
  279.      quotes, for example, "Hello", "Good-bye", or "Telix". It is often nec-
  280.      essary for a string constant to include special characters that can
  281.      not easily be typed from the keyboard, or can not be easily displayed.
  282.      This is done with something called the escape character, which is the
  283.      caret ('^') symbol. When the SALT compiler is reading a string con-
  284.      stant and comes to the '^' symbol, it replaces it with a certain ASCII
  285.      code based on the character following the ^. Translations are as fol-
  286.      lows:
  287.  
  288.           ^c        'c' is a letter. The Control representation of whatever
  289.                     letter 'c' is, is inserted into the text. Therefore ^M
  290.                     represents Ctrl-M, ^j represents Ctrl-J, etc. Whether
  291.                     the letter 'c' is upper or lower case is not signifi-
  292.                     cant. Note that what is really happening here is that
  293.                     64 is being subtracted from the value of 'c', so for
  294.                     example, the Escape character can be represented as ^[.
  295.           ^^        An actual caret ('^') symbol is placed into the text.
  296.      Telix v3.5x - SALT Programming                             Syntax    4
  297.  
  298.  
  299.  
  300.           ^"        An actual double quote symbol ('"') is placed into the
  301.                     text. If a string must contain a double quote symbol,
  302.                     this is how it has to be done. If the plain '"' symbol
  303.                     were to be used, the compiler would think that the
  304.                     string was terminated at that point. For example, the
  305.                     string "He said, ^"Hello^"." is translated to 'He said,
  306.                     "Hello".'.
  307.           ^'        An actual single quote symbol (''') is placed into the
  308.                     text.
  309.           ^nnn      'nnn' is up to 3 digits representing the ASCII value of
  310.                     the character which should be placed into the text. A
  311.                     maximum of three digits is read, or up to the first
  312.                     non-digit character. For example, the compiler would
  313.                     read in the string "S^65LT" and output the string
  314.                     "SALT", since 65 is the ASCII value of 'A'. Note that
  315.                     if nnn is less than 3 digits you may have to pad it
  316.                     with one or two leading zeros if there are digits imme-
  317.                     diately following it in the string, so that the wrong
  318.                     value is not read in. For example the string "^79 Park
  319.                     Avenue" would translate to "O Park Avenue" since 79 is
  320.                     the ASCII value of 'O'. If you actually wanted Ctrl-G
  321.                     (ASCII code 7) followed by "9 Park Avenue", you would
  322.                     use the string "^0079 Park Avenue".
  323.  
  324.      An integer constant is a sequence of digits representing an integer
  325.      value in the range -2147483648 to 2147483647. An integer constant must
  326.      start with a digit from 0 to 9 or the negative sign (-) followed by a
  327.      digit. The following are all valid integer constants:
  328.  
  329.           10
  330.           -400067
  331.           999
  332.  
  333.      An integer constant may also be entered in hexadecimal form (base 16,
  334.      where each digit may be from '0' to '9' or 'a' to 'f', to represent 16
  335.      values). Hex values must be preceded by '0x' for the compiler to in-
  336.      terpret them as such, and case is not important. The following are all
  337.      valid integer constants enter in hexadecimal form:
  338.  
  339.           0xff00
  340.           0Xa2
  341.           0x7D
  342.           0x1AbCdEf
  343.  
  344.  
  345.      2.1  Comments
  346.      ──────────────────────────────────────────────────────────────────────
  347.  
  348.      A comment in a source file is text that does not affect what the pro-
  349.      gram does, and is meant purely for explaining or describing something.
  350.      In a SALT source file, whenever the symbol // is encountered on a
  351.      line, all the characters from that point on until the end of the line
  352.      are considered to be a comment and are ignored. For example:
  353.  
  354.           prints("Hello");       // This line will print "Hello"
  355.      Telix v3.5x - SALT Programming                  Program Structure    5
  356.  
  357.  
  358.  
  359.  
  360.  
  361.      3.  PROGRAM STRUCTURE
  362.  
  363.      A SALT script has the following format:
  364.  
  365.           <global_variable_definition>
  366.                ...
  367.           <global_variable_definition>
  368.  
  369.           <function_definition>
  370.  
  371.           <global_variable_definition>
  372.                ...
  373.           <global_variable_definition>
  374.  
  375.           <Function_definitions>
  376.  
  377.                ...
  378.  
  379.      and so on. Basically a script file consists of definition of global
  380.      variables (variables which are available to any part of the script
  381.      file after which they are defined, and function definitions (functions
  382.      are lines of code clustered together in a group, so that they can be
  383.      called by a name). A script file does not have to have any global
  384.      variables or functions, but to run it must at least have one function
  385.      called 'main'. The following, for example, is a complete script file:
  386.  
  387.           main()
  388.  
  389.           {
  390.  
  391.            prints ("hello");
  392.  
  393.           }
  394.  
  395.      When compiled and run, this script would print the string "hello" to
  396.      the screen.
  397.  
  398.  
  399.      3.1  Variables
  400.      ──────────────────────────────────────────────────────────────────────
  401.  
  402.      A variable is a location in memory where something is stored. The con-
  403.      tents of a variable can be changed by program code (hence the name).
  404.      In SALT, there are two types of variables, integer variables, and
  405.      string variables. The former holds an integer value (e.g., 485624, or
  406.      -627), while the latter holds a text string (e.g. "Telix", or
  407.      "SCRIPT"). Depending on where it is defined, a variable is either
  408.      global or local. If a variable is global, it means that it can be used
  409.      by any part of the script after the point where it is defined. If a
  410.      variable is local, it means that it can only be used by the part of
  411.      the script to which it is 'local', for example, the function inside
  412.      which it is defined. A variable name can be up to 31 digits long, and
  413.      may include the letters 'A' to 'Z' or 'a' to 'z', the digits '0' to
  414.      '9', or the underscore character (_). The name may not start with a
  415.      Telix v3.5x - SALT Programming                  Program Structure    6
  416.  
  417.  
  418.  
  419.      digit. For example, 'his_name2' and '_his_name2' are legal as variable
  420.      names, while '2his_name' is not.
  421.  
  422.      An integer variable is defined in the form
  423.  
  424.           int <varname>;
  425.  
  426.      where <varname> is the name to be given to the variable. An alternate
  427.      definition is
  428.  
  429.           int <varname1>, <varname2>, ..., <varnameN>;
  430.  
  431.      which allows you to define more than one integer variable in one
  432.      statement. An original value can be assigned to the integer variable
  433.      by using the form
  434.  
  435.           int <varname> = <int_const>;
  436.  
  437.      where <int_const> is an integer constant. Similarly, an original value
  438.      can be assigned in the multiple definition above by placing the as-
  439.      signment before the comma. Some examples are:
  440.  
  441.           int maximum;
  442.           int start = 0;
  443.           int level, i, count = 20, loop;
  444.  
  445.      A string variable is defined in the form
  446.  
  447.           str <varname>[<max>];
  448.  
  449.      where <varname> is the name to be given to the variable. <max> is the
  450.      maximum number of characters that the string can hold, and must be in
  451.      the range of 0 to 32767. An alternate definition is
  452.  
  453.           str <varname>[<max>], <varname2>[<max>], ..., <varnameN>[<max>];
  454.  
  455.      which allows you to define more than one string variable in a state-
  456.      ment. An original value can be assigned to the string variable by us-
  457.      ing the form
  458.  
  459.           str <varname>[<max>] = <str_const>;
  460.  
  461.      where <str_const> is a string constant. Similarly, an original value
  462.      can be assigned in the multiple definition above by placing the as-
  463.      signment before the comma. Some examples are:
  464.  
  465.           str password[80];
  466.           str password[40] = "mypass", name[30];
  467.  
  468.      The string length field may be left empty if an original value is
  469.      specified, in which case the length of the string variable is assumed
  470.      to be that of the assigned text, e.g.
  471.  
  472.           str name[] = "John";
  473.  
  474.      If a variable is outside of a function, it is global. If it is defined
  475.      inside a function, it is local to that function and will only be rec-
  476.      Telix v3.5x - SALT Programming                  Program Structure    7
  477.  
  478.  
  479.  
  480.      ognized there. If a variable defined inside a function uses the same
  481.      name as a global variable, any reference to that name while in the
  482.      function will access the local variable. After the function has com-
  483.      pleted, the local variable is removed and a reference to that name
  484.      will access the global variable.
  485.  
  486.  
  487.      3.2  Expressions and Operators
  488.      ──────────────────────────────────────────────────────────────────────
  489.  
  490.      An expression is a mixture of symbols which resolves to a value when
  491.      evaluated. In other words, an expression is basically a formula. An
  492.      expression can consist of constants, variables, function calls, and
  493.      operators. An expression can be very simple, or very complicated. For
  494.      example, some expressions are:
  495.  
  496.           10 + 3 - 5
  497.           9 * 7 / 63 - 30
  498.           result = 10 * max(a, b)
  499.           month >= 10
  500.           200
  501.           command == "bye"
  502.           prints("Hello")
  503.  
  504.      In an expression, the data being acted upon are constants, variables,
  505.      and functions calls, while the operators (+, *, etc.) are the symbols
  506.      that do things with the data. There are many different operators, of
  507.      which there are two basic types. Binary operators (such as +, *, /)
  508.      perform a calculation on the expression on either side of them. Unary
  509.      operators appear before a single expression and work on that. The fol-
  510.      lowing table lists the operators available in SALT:
  511.  
  512.             Symbol      (Un/Bin)ary          What it is/does
  513.               -            unary             Arithmetic negation
  514.               !            unary             Logical NOT
  515.              not           unary             Logical NOT (alternate)
  516.               ++           unary             Increment
  517.               --           unary             Decrement
  518.               *            binary            Multiplication
  519.               /            binary            Division
  520.               %            binary            Remainder (Mod)
  521.               +            binary            Addition
  522.               -            binary            Subtraction
  523.               <            binary            Less than
  524.               >            binary            Grater than
  525.               <=           binary            Less than or equal to
  526.               >=           binary            Greater than or equal to
  527.               ==           binary            Equality
  528.               !=           binary            Inequality
  529.               &            binary            Bitwise AND
  530.               |            binary            Bitwise OR
  531.               ^            binary            Bitwise Exclusive OR
  532.               &&           binary            Logical AND
  533.              and           binary            Logical AND (alternate)
  534.               ||           binary            Logical OR
  535.               or           binary            Logical OR (alternate)
  536.               =            binary            Assignment
  537.      Telix v3.5x - SALT Programming                  Program Structure    8
  538.  
  539.  
  540.  
  541.  
  542.      Note that the hyphen symbol can be either an arithmetic negation or a
  543.      subtraction depending on its use. Note that '!' is equivalent to
  544.      'not', '&&' is equivalent to 'and', and '||' is equivalent to 'or'.
  545.      The first form is preferred as you do not have to leave whitespace
  546.      around it for the compiler to recognize it, but beginners may have an
  547.      easier time remembering the second form. Also, do not confuse the '='
  548.      (assignment operator) with the '==' (equality operator). The former is
  549.      used to assign a value to a variable, while the latter is used to com-
  550.      pare two values. Assuming you have the two expressions, <expr1> and
  551.      <expr2>, <expr1> = <expr2> would assign one to the other, while
  552.      <expr1> == <expr2> would test the two to see if they are equal. For
  553.      example
  554.  
  555.           num = 10
  556.  
  557.      would assign the value 10 to the variable called 'num', while
  558.  
  559.           num == 10
  560.  
  561.      would resolve to a value of non-zero (TRUE) if num was equal to 10,
  562.      and 0 (FALSE) if num was not equal to 10. There is also a difference
  563.      between the Logical operators and the Bitwise operators. The Logical
  564.      operators (such as and, &&, or, ||, etc), work with TRUE or FALSE val-
  565.      ues and result in a TRUE or FALSE value, while the Bitwise operators
  566.      (&, |, ^) work with the actual bits of the data they are handling. The
  567.      Bitwise operators almost never have to be used in a Telix script, un-
  568.      less it is needed to get at the actual bits in a data byte.
  569.  
  570.      Every operator resolves to a value, which is the result of the opera-
  571.      tion performed (e.g, 10 * 7 would resolve to 70). The conditional or
  572.      equality operators such as ==, >, <=, etc., resolve to  a 0 (FALSE))
  573.      or non-zero (TRUE) value based on the results of the expression. Even
  574.      the assignment operator = resolves to a value. The result of the ex-
  575.      pression
  576.  
  577.           num = 10
  578.  
  579.      would be 10.
  580.  
  581.      All the operators have something called precedence, which is their im-
  582.      portance, and determines the order in which they are evaluated. For
  583.      example, 7 + 3 * 9 is equal to 34, because 3 * 9 is evaluated first,
  584.      and then added to 7 (* has a higher precedence than +). All the opera-
  585.      tors are listed below in order of decreasing precedence. All the oper-
  586.      ators on the same line have the same precedence, and are resolved in
  587.      the order that they are encountered.
  588.      Telix v3.5x - SALT Programming                  Program Structure    9
  589.  
  590.  
  591.  
  592.           -  !
  593.           ++  --
  594.           *  /  %
  595.           +  -
  596.           <  >  <=  >=
  597.           ==  !=
  598.           &
  599.           |
  600.           and  &&
  601.           or  ||
  602.           =
  603.  
  604.      If a certain evaluation order is required that does not follow these
  605.      rules of precedence, parentheses may be used. Thus, 99 + 1 * 10 equals
  606.      109, while (99 + 1) * 10 equals 1000.
  607.  
  608.      If you are writing an expression of any sort, and are not sure of the
  609.      exact precedence of the operators you are using, use parentheses!
  610.  
  611.  
  612.      3.3  Functions
  613.      ──────────────────────────────────────────────────────────────────────
  614.  
  615.      A function is a way of grouping together some lines of code. A Telix
  616.      script consists of one or more functions. There are quite a few advan-
  617.      tages to having functions:
  618.  
  619.           One function can be called from another, to do a certain task.
  620.           The calling function does not have to know anything about the
  621.           called function other than what it does. This allows a script to
  622.           be split up into modular units, and makes code writing and debug-
  623.           ging easier.
  624.  
  625.           As mentioned above, what a function does it private. This means
  626.           that data variables defined in a function are local to that func-
  627.           tion, and therefore you do not have to worry about another part
  628.           of the script unintentionally modifying them.
  629.  
  630.           A library of functions can thus be built. Later, you do not have
  631.           to re-write old code.
  632.  
  633.      Functions are defined in the following format:
  634.  
  635.           <funcname>(<arg1>, <arg2>, ..., <argN>)
  636.  
  637.           {
  638.            <variable_def>
  639.                ...
  640.            <variable_def>
  641.  
  642.            <statement>
  643.                ...
  644.            <statement>
  645.           }
  646.      Telix v3.5x - SALT Programming                 Program Structure    10
  647.  
  648.  
  649.  
  650.      <funcname> is the name of the function. It follows the same rules of
  651.      other identifiers in SALT. There can only be one function that uses a
  652.      given name, however.
  653.  
  654.      <arg1> through <argN> are the declarations of the arguments
  655.      (parameters) that have been passed to the function by its caller
  656.      (sometimes, to accomplish its task, a function needs to have some val-
  657.      ues passed to it). Each argument is defined in the form <type> <name>
  658.      where <type> is 'int' or 'str', and <name> is the name it should be
  659.      called by. At present, a function is not allowed to have more than 12
  660.      values passed to it.
  661.  
  662.      <variable_def> is a variable definition, as described in the above
  663.      section on that topic. Any number of variables may be declared at this
  664.      part of the function. All such variables will be local variables and
  665.      available only to this function.
  666.  
  667.      <statement> is an actual line of code. There may be as many lines of
  668.      statements in the function as needed. The format of a statement is de-
  669.      scribed below. First though, here is an example of a complete func-
  670.      tion:
  671.  
  672.           max ( int a, int b )
  673.  
  674.           {
  675.  
  676.            int result;
  677.  
  678.            if (a > b)
  679.             result = a;
  680.            else
  681.             result = b;
  682.  
  683.            return result;
  684.  
  685.           }
  686.  
  687.      This function returns the larger (maximum) of the two values passed to
  688.      it. It could have been written much more simply (without the use of
  689.      the variable), but was written this way so that all the function ele-
  690.      ments would be there.
  691.  
  692.  
  693.      3.4  Statements
  694.      ──────────────────────────────────────────────────────────────────────
  695.  
  696.      A statement is the basic element of code. A statement ALWAYS ends with
  697.      a semicolon character (;). In any location where a statement is ac-
  698.      ceptable, you may use a group of statements, by enclosing them all in
  699.      curly braces (more on this below). There are many types of statements,
  700.      including: expression, if, while, do...while, for, return, break, con-
  701.      tinue, and goto statements. Each type has several different parts.
  702.      Telix v3.5x - SALT Programming                 Program Structure    11
  703.  
  704.  
  705.  
  706.      3.4.1  The Expression statement
  707.  
  708.      The 'expression' statement is the simplest and most common type of
  709.      statement. Its format is
  710.  
  711.           <expression>;
  712.  
  713.      where <expression> is any expression. Example are:
  714.  
  715.           result = 20;
  716.           password = "Beef";
  717.           pause(20);
  718.           num = 20 * max(a, b);
  719.  
  720.      Do not forget the semicolon character at the end of the statement. If
  721.      you do, the compiler will think that the next statement is part of the
  722.      current one, and will report some unexpected error.
  723.  
  724.  
  725.      3.4.2  The If statement
  726.  
  727.      An 'if' statement is used when a statement or group of statements
  728.      should be evaluated only if a condition is true. The format for an
  729.      'if' statement is as follows:
  730.  
  731.           if (<expression>)
  732.             <statement>
  733.  
  734.      <statement> is any statement as described above and below (that is, an
  735.      expression, if, while, do...while, for, return, break, or continue
  736.      statement), and will only be executed if <expression> evaluates to
  737.      non-zero. By using curly braces around them, a whole group of state-
  738.      ments may be conditionally evaluated. Some examples are:
  739.  
  740.           if (result == -1)
  741.             prints("ERROR!");
  742.  
  743.           if (num_tries > maximum)
  744.             return 0;
  745.  
  746.           if (month > 10 && day < 20)
  747.            {
  748.             clear();
  749.             prints("In range.");
  750.             return 1;
  751.            }
  752.  
  753.      An alternate form of the if statement is:
  754.  
  755.           if (<expression>)
  756.             <statement1>
  757.           else
  758.             <statement2>
  759.  
  760.      In this case, if <expression> evaluates to non-zero (TRUE),
  761.      <statement1> is executed, otherwise <statement2> is executed. Again,
  762.      Telix v3.5x - SALT Programming                 Program Structure    12
  763.  
  764.  
  765.  
  766.      multiple statements may be used instead by grouping them in curly
  767.      braces. Some examples are:
  768.  
  769.           if (stat == -1)
  770.             prints("Error status returned.");
  771.           else
  772.             prints("Function finished without problems.");
  773.  
  774.           if (level < 10)
  775.            {
  776.             alarm(1);
  777.             prints("Warning!");
  778.            }
  779.           else
  780.             prints("Everything's ok.");
  781.  
  782.      Since the statement to be executed conditionally can be of any type,
  783.      that means that any number of if statement can be nested if needed.
  784.      For example:
  785.  
  786.           if (num < 10)
  787.             if (!error)
  788.               if (read != 0)
  789.                 return 1;
  790.  
  791.      This also means that something like the following is legal:
  792.  
  793.           if (value == 10)
  794.             do_this();
  795.           else if (value == 100)
  796.             do_that();
  797.           else if (value == 1000)
  798.             do_something_else();
  799.           else
  800.             do_whatever();
  801.  
  802.      What is really happening here is that each if statement is being
  803.      nested after the else portion of the previous one. The above example
  804.      could also be written as:
  805.  
  806.           if (value == 10)
  807.             do_this();
  808.           else
  809.             if (value == 100)
  810.               do_that();
  811.             else
  812.               if (value == 1000)
  813.                 do_something_else();
  814.               else
  815.                 do_whatever();
  816.  
  817.      Any amount of nesting is theoretically legal, but the compiler does
  818.      have a limit due to memory constraints.
  819.  
  820.      While you may write the code in any way which suits you, it is recom-
  821.      mended that you use indenting, for clarity. Indenting your code at the
  822.      proper places makes it a lot easier to read.
  823.      Telix v3.5x - SALT Programming                 Program Structure    13
  824.  
  825.  
  826.  
  827.      A very common error to watch out for is accidentally placing a semi-
  828.      colon after the parenthesis ending the expression. For example, if the
  829.      following is run:
  830.  
  831.           if (num == 10);
  832.             prints("Num is equal to 10);
  833.  
  834.      the string would always be printed, no matter what num was equal to.
  835.      This is because the semicolon after the parenthesis ending the expres-
  836.      sion signifies the end of the statement. In the above case, it would
  837.      just be a null (empty) statement.
  838.  
  839.  
  840.      3.4.3  The While statement
  841.  
  842.      The while statement is used to loop continuously while a certain con-
  843.      dition is true. It has the form
  844.  
  845.           while (<expression>)
  846.             <statement>
  847.  
  848.      <statement> would continue to be repeated over and over while
  849.      <expression> evaluated to non-zero (TRUE). Note that if the expression
  850.      evaluates to 0 (FALSE) from the beginning, the statement will never be
  851.      executed. Again, multiple statements may be used by surrounding them
  852.      in curly braces. A few examples are:
  853.  
  854.           while (stat != -1)
  855.             stat = myfunc();
  856.  
  857.           while (num < 100)
  858.             {
  859.              printn(num);
  860.              prints("");
  861.              num = num + 1;
  862.             }
  863.  
  864.           while (1)
  865.             {
  866.              if (func1())
  867.                return 0;
  868.  
  869.              func2();
  870.             }
  871.  
  872.      Again, be careful to not place a semicolon after the parenthesis end-
  873.      ing the expression.
  874.  
  875.  
  876.      3.4.4  The Do...While statement
  877.  
  878.      The do...while statement is similar to the while statement and has the
  879.      form:
  880.  
  881.           do
  882.             <statement>
  883.           while (<expression>);
  884.      Telix v3.5x - SALT Programming                 Program Structure    14
  885.  
  886.  
  887.  
  888.  
  889.      <statement> will be executed at least once and will continue to be ex-
  890.      ecuted repeatedly until the expression becomes 0 (FALSE). A few exam-
  891.      ples are:
  892.  
  893.           do
  894.             stat = func1();
  895.           while (stat != -1);
  896.  
  897.           do
  898.            {
  899.             prints("hello");
  900.             num = num + 1;
  901.            }
  902.           while (num < 100);
  903.  
  904.  
  905.      3.4.5  The For statement
  906.  
  907.      The for statement is used to loop continuously while a certain condi-
  908.      tion is true. The advantages over the while statement is that a count
  909.      variable can be initialized and incremented quite easily. The for
  910.      statement has the form:
  911.  
  912.           for (<expression1>; <expression2>; <expression3>)
  913.             <statement>
  914.  
  915.      The first expression is the one that should initialize the count vari-
  916.      able. For example, if you wanted to count from 1 to 100, and were
  917.      keeping the count in a variable called 'num', the first expression
  918.      would be 'num = 1'. The second expression is the conditional test. As
  919.      long as it evaluates to non-zero (TRUE), the statement will be exe-
  920.      cuted. Following the above example, this expression would be
  921.      'num < 100'. The third expression is the one that is used to increment
  922.      the count variable. For the above example, it would therefore be
  923.      'num = num + 1'. This for statement differs in format from that in
  924.      most other languages, but doing it this way is actually gives the pro-
  925.      grammer a lot of power and flexibility. Note that any of the expres-
  926.      sions can be left empty, in which case they evaluate to non-zero
  927.      (TRUE). Some examples are:
  928.  
  929.           for (count = 0; count < 100; count = count + 1)
  930.            {
  931.             printn(count);
  932.             prints("");
  933.            }
  934.  
  935.           for (c = 1000; c > 0; c = c - 1)
  936.             do_this(c);
  937.  
  938.      The following would execute an infinite loop:
  939.  
  940.           for (;;)
  941.             prints("Hello!");
  942.  
  943.      Note that there is really no restriction on what the expressions are.
  944.      For example, the following is quite legal:
  945.      Telix v3.5x - SALT Programming                 Program Structure    15
  946.  
  947.  
  948.  
  949.           for (c = num = 0; c < 100 && stat != -1; c = c + 1)
  950.             {
  951.              stat = func(num);
  952.              num = func2();
  953.             }
  954.  
  955.      The statements would only be executed if c was smaller than 100 and
  956.      stat didn't equal -1.
  957.  
  958.  
  959.      3.4.6  The Return statement
  960.  
  961.      At some time, every function must be exited. If the end of the func-
  962.      tion is reached, control will automatically return to the calling
  963.      function. Very often however, it is necessary to leave a function
  964.      somewhere while only halfway through it, perhaps based on a condi-
  965.      tional test. As well, it is often necessary that a function returns a
  966.      value to the caller. The format of the return statement is:
  967.  
  968.           return <expression>;
  969.  
  970.      If the return statement is encountered anywhere in the function, con-
  971.      trol immediately returns to the function that called this function.
  972.      The expression is the value that should be returned. If no expression
  973.      is supplied, a dummy value is returned. The expression should match
  974.      they type of value that the caller of this function is expecting. That
  975.      is, if an 'int' type is expected, the expression should resolve to an
  976.      integer value. If a 'str' type is expected, the expression should re-
  977.      solve to a string value. Due to memory constraints, a local string
  978.      variable may NOT be returned from a function. Some examples are:
  979.  
  980.           return;
  981.           return 1;
  982.           return level;
  983.           return (sum + 25);
  984.           return "hello";
  985.           return (func() + 20);
  986.  
  987.      Notice that when a complex expression is returned it is usually sur-
  988.      rounded by parentheses. This is done only for clarity and is not nec-
  989.      essary. Also, it should be clear that what is returned is not the ex-
  990.      pression but what it evaluates to.
  991.  
  992.  
  993.      3.4.7  The Break statement
  994.  
  995.      Often while using a looping statement (while, do...while, for), it is
  996.      necessary to break out of (exit) the loop. The break statement serves
  997.      this purpose. When the break statement is encountered, execution of
  998.      the smallest while, do...while, or for loop is terminated, and execu-
  999.      tion continues immediately after the terminated loop statement. It is
  1000.      an error for a break statement to appear outside of a loop. The format
  1001.      of the break statement is:
  1002.  
  1003.           break;
  1004.  
  1005.      For example, assuming you had the following code:
  1006.      Telix v3.5x - SALT Programming                 Program Structure    16
  1007.  
  1008.  
  1009.  
  1010.           int num = 0;
  1011.           while (1)
  1012.            {
  1013.             num = num + 1;
  1014.             if (num > 100)
  1015.               break;
  1016.            }
  1017.           prints("Done");
  1018.  
  1019.      Ordinarily, since there will always be a non-zero (TRUE) value in the
  1020.      conditional part of this while statement, it would execute forever.
  1021.      However, when the 'num' variable is > 100, the break statement is exe-
  1022.      cuted to exit from the loop, at which point the next statement would
  1023.      be executed (the function call to prints).
  1024.  
  1025.  
  1026.      3.4.8  The Continue statement
  1027.  
  1028.      The continue statement is used within a loop (while, do...while, or
  1029.      for statement). The continue statement has the form:
  1030.  
  1031.           continue;
  1032.  
  1033.      It is illegal for a continue statement to appear outside of a loop
  1034.      body. When a continue statement is encountered, program control is im-
  1035.      mediately transferred to the end of the body of the innermost en-
  1036.      closing while, do...while, or for statement. The effect in a while or
  1037.      do...while statement is that the condition part of the while or
  1038.      do...while statement is evaluated, and the next iteration of the loop
  1039.      occurs. For example:
  1040.  
  1041.           num = 0;
  1042.           while (num < 100000)
  1043.            {
  1044.             num = num + 1;
  1045.             if (num > 100)
  1046.              continue;
  1047.             prints("Hello");
  1048.            }
  1049.  
  1050.      The effect of the continue statement in the above loop would be that
  1051.      'Hello' would only be printed while 'num' was smaller or equal to 100,
  1052.      as the continue statement is executed when num is bigger than 100,
  1053.      which causes the rest of the loop body to be skipped. An example for
  1054.      statement would be:
  1055.  
  1056.           for (num = 0; num < 100000; num = num + 1)
  1057.            {
  1058.             if (num > 100)
  1059.              continue;
  1060.             prints("Hello");
  1061.            }
  1062.  
  1063.      The effect in this case would be the same. While 'num' is smaller or
  1064.      equal to 100, the entire loop body executes. If 'num' is greater than
  1065.      100 however, the continue statement is executed. This causes the rest
  1066.      of the loop body to be skipped, so the 'Hello' is then not printed.
  1067.      Telix v3.5x - SALT Programming                 Program Structure    17
  1068.  
  1069.  
  1070.  
  1071.      3.4.9  The Goto statement
  1072.  
  1073.      The goto statement is used to branch (jump) from one place to another,
  1074.      within a function. The use of goto statements is considered bad style.
  1075.      They can make code very hard to understand, and are in fact almost
  1076.      never necessary. For example, Telix is written mainly in the C lan-
  1077.      guage, which has a goto statement, yet except for a few pieces of pre-
  1078.      written code, the goto statement was never used nor needed. On the
  1079.      other hand, used very sparingly and properly, it can sometimes make
  1080.      some code clearer and perhaps faster. The goto statement consists of
  1081.      two parts, the 'label' or marker, which is where execution will jump
  1082.      to, and the actual goto itself. A label is defined in the form
  1083.  
  1084.           <identifier>:
  1085.  
  1086.      where <identifier> follows the same rules as for variable names. Note
  1087.      that a colon follows the name, not a semicolon. The colon character
  1088.      must immediately follow the label name, with no intervening spaces. A
  1089.      label does not have to be on a line by itself, and is not considered a
  1090.      statement by itself. The goto takes the form
  1091.  
  1092.           goto <label>;
  1093.  
  1094.      where <label> is a label elsewhere in the function defined as de-
  1095.      scribed above. Execution of the script will immediately continue fol-
  1096.      lowing the label.
  1097.  
  1098.      An example is:
  1099.  
  1100.           start:
  1101.           prints("Hello");
  1102.           goto start;
  1103.  
  1104.      This would print the word "hello" over and over, forever. There is no
  1105.      restriction on the placement of a label, so the above can be written
  1106.      as:
  1107.  
  1108.           start: prints("Hello");
  1109.           goto start;
  1110.  
  1111.      As mentioned above, there are usually better ways than using a goto
  1112.      statement. For example:
  1113.  
  1114.           int i = 0;
  1115.           do
  1116.            i = i + 1;
  1117.           while (i < 100);
  1118.  
  1119.      is clearer than the equivalent:
  1120.  
  1121.           int i = 0;
  1122.           loop:
  1123.            i = i + 1;
  1124.            if (i < 100)
  1125.             goto loop;
  1126.      Telix v3.5x - SALT Programming                 Program Structure    18
  1127.  
  1128.  
  1129.  
  1130.      One good use of a goto statement is to get out of a deeply nested
  1131.      while statements, without having to do a lot of extra checking.
  1132.      Telix v3.5x - SALT Programming                Built-in Functions    19
  1133.  
  1134.  
  1135.  
  1136.      4.  BUILT-IN FUNCTIONS
  1137.  
  1138.      Telix's SALT has quite a large number of built-in functions. These
  1139.      functions are called just as you would call your own SALT functions.
  1140.      Each function does a certain task (print something to the screen, ma-
  1141.      nipulate strings, access disk files, etc.). Each function is called
  1142.      with parameters in a certain format and returns an integer or string
  1143.      value (the return value does not have to be used and is often a dummy
  1144.      variable).
  1145.  
  1146.      The following pages contain a quick listing of the functions by type
  1147.      followed by a complete description of each function, in alphabetical
  1148.      order. The complete reference contains for each function, a summary of
  1149.      the calling format, a description of what it does, and the return
  1150.      value of the function are all given. An example of actual usage of the
  1151.      function is often given. Note that the examples are fragments of pro-
  1152.      gram code for the most part, and may not explicitly declare all needed
  1153.      variables. So that you may find related functions, each function de-
  1154.      scription has a 'See Also' section, which lists related functions.
  1155.      Telix v3.5x - SALT Programming                Built-in Functions    20
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.      4.1  Quick Listing of Functions by Type
  1163.      ──────────────────────────────────────────────────────────────────────
  1164.  
  1165.      Video Operations
  1166.  
  1167.      box, cursor_onoff, clear_scr, getx, gety, gotoxy, printc, printn,
  1168.      prints, printsc, pstra, pstraxy, scroll, status_wind, update_term
  1169.  
  1170.      String Handling
  1171.  
  1172.      copychrs, copystr, delchrs, gets, getsxy, inschrs, itos, setchr,
  1173.      setchrs, stoi, strcat, strchr, strcmpi, strlen, strlower, strmaxlen,
  1174.      strpos, strposi, strupper, subchr, subchrs, substr
  1175.  
  1176.      Character Handling
  1177.  
  1178.      isascii, isalnum, isalpha, iscntrl, isdigit, islower, isupper,
  1179.      tolower, toupper
  1180.  
  1181.      Comm Port Operations
  1182.  
  1183.      carrier, cinp_cnt, cgetc, cgetct, cputc, cputs, cputs_tr, flushbuf,
  1184.      get_baud, get_datab, get_parity, get_port, get_stopb, hangup,
  1185.      set_cparams, set_port
  1186.  
  1187.      File and File I/O Operations
  1188.  
  1189.      fclearerr, fclose, fdelete, ferror, feof, fflush, fgetc, fgets,
  1190.      fileattr, filefind, filesize, filetime, fnstrip, fopen, fputc, fputs,
  1191.      fread, frename, fseek, ftell, fwrite
  1192.  
  1193.      Keyboard Operations
  1194.  
  1195.      inkey, inkeyw, keyget, keyload, keysave, keyset
  1196.  
  1197.      Date/Time and Timer Operations
  1198.  
  1199.      curtime, date, tsec, tday, thour, time, time_up, timer_free,
  1200.      timer_restart, timer_start, timer_total, tmin, tmonth, tyear
  1201.  
  1202.      File Transfers, Capture, Printer, and Usage Log
  1203.  
  1204.      capture, printer, receive, send, transtab, usagelog, ustamp
  1205.  
  1206.      Script Management
  1207.  
  1208.      call, calld, delay_scr, is_loaded, load_scr, unload_scr
  1209.  
  1210.      Input String Matching
  1211.  
  1212.      track, track_addchr, track_free, track_hit, waitfor
  1213.      Telix v3.5x - SALT Programming                Built-in Functions    21
  1214.  
  1215.  
  1216.  
  1217.      Other Functions
  1218.  
  1219.      alarm, chatmode, delay, dial, dos, dosfunction, exittelix, helpscreen,
  1220.      loadfon, newdir, redial, redirect_dos, run, send_brk, set_defprot,
  1221.      set_terminal, show_directory, terminal, tone
  1222.      Telix v3.5x - SALT Programming                Built-in Functions    22
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.      4.2  Complete Function Reference
  1230.      ──────────────────────────────────────────────────────────────────────
  1231.  
  1232.  
  1233.  
  1234.  
  1235.      ALARM
  1236.      ──────────────────────────────────────────────────────────────────────
  1237.  
  1238.      ■  Summary
  1239.  
  1240.      alarm(int <seconds>);
  1241.  
  1242.      ■  Description
  1243.  
  1244.      The alarm functions sounds an alarm for a a duration in seconds given
  1245.      by <seconds>.
  1246.  
  1247.      ■  Return Value
  1248.  
  1249.      The <seconds> argument is returned.
  1250.  
  1251.      ■  See Also
  1252.  
  1253.      tone, _alarm_on, _sound_on
  1254.  
  1255.      ■  Example
  1256.  
  1257.      while (!inkey())
  1258.        alarm(1);
  1259.  
  1260.  
  1261.  
  1262.      BOX
  1263.      ──────────────────────────────────────────────────────────────────────
  1264.  
  1265.      ■  Summary
  1266.  
  1267.      box(int <x>, int <y>, int <x2>, int <y2>, int <style>, int <hollow>,
  1268.      int <color>);
  1269.  
  1270.      ■  Description
  1271.  
  1272.      The box function is used to create a box on the screen. The box will
  1273.      have an upper left hand corner of <x>,<y> and a lower right hand cor-
  1274.      ner of <x2>,<y2>. The box must fit within the confines of the screen.
  1275.      <color> is the color to use in drawing the box. If <hollow> is a non-
  1276.      zero (TRUE) value, the inside of the box is not cleared. <style> se-
  1277.      lects what kind of box to draw, as follows:
  1278.      Telix v3.5x - SALT Programming                Built-in Functions    23
  1279.  
  1280.  
  1281.  
  1282.           0    Spaces
  1283.           1    Single lines
  1284.           2    Double lines
  1285.           3    Single vertical lines, double horizontal lines
  1286.           4    Double vertical lines, single horizontal lines
  1287.  
  1288.      If <style> is any other value, that character is used to construct the
  1289.      sides of the box.
  1290.  
  1291.      ■  Return Value
  1292.  
  1293.      None.
  1294.  
  1295.      ■  See Also
  1296.  
  1297.      scroll
  1298.  
  1299.      ■  Example
  1300.  
  1301.      box(10, 10, 70, 20, 1, 0, 112);    // draw box in inverse color
  1302.  
  1303.  
  1304.      CALL, CALLD
  1305.      ──────────────────────────────────────────────────────────────────────
  1306.  
  1307.      ■  Summary
  1308.  
  1309.      call(str <scriptname>, <arg1>, <arg2>, <arg3>, ...);
  1310.  
  1311.      calld(str <scriptname>, <arg1>, <arg2>, <arg3>, ...);
  1312.  
  1313.      ■  Description
  1314.  
  1315.      The call function is used when one script file must call (jump into
  1316.      and then return from) another. <scriptname> is the name of the script
  1317.      file to call. If no extension is given, .SLC is assumed. <arg1>
  1318.      through <argn> are the arguments or parameters to be passed to the
  1319.      'main' function of the called script. The value returned is the value
  1320.      returned by the 'main' function of the called script, and can be an
  1321.      integer or a string value, although the called script can not return
  1322.      string variables local to itself. If the script file to be called is
  1323.      already in memory because it was previously loaded and made resident,
  1324.      or it is still executing from a previous call, it is not released but
  1325.      instead the memory image is used. This means that global variables
  1326.      will have whatever values a previous run through left in them.
  1327.  
  1328.      The calld function is exactly the same as the call function, except
  1329.      that even if an image of the indicated script file is already in mem-
  1330.      ory, a new copy is still loaded from disk. This ensures that global
  1331.      variables within the script will be set as defined in the source file,
  1332.      and that there will be enough stack space, but requires more memory
  1333.      and is slower.
  1334.  
  1335.      ■  Return Value
  1336.  
  1337.      An integer or string value representing the value returned by the main
  1338.      function of the called script file. This value must not be a string
  1339.      Telix v3.5x - SALT Programming                Built-in Functions    24
  1340.  
  1341.  
  1342.  
  1343.      variable defined within the called script, for memory reasons. if the
  1344.      indicated script can not be found or loaded, a value of -1 is re-
  1345.      turned. If the called script is aborted by the user, a value of -1 is
  1346.      returned.
  1347.  
  1348.      ■  See Also
  1349.  
  1350.      load_scr, unload_scr, is_loaded
  1351.  
  1352.      ■  Example
  1353.  
  1354.      stat = call("TEST");
  1355.      if (stat == -1)
  1356.       prints("Called script could not be loaded or was aborted!");
  1357.  
  1358.  
  1359.  
  1360.  
  1361.      CAPTURE
  1362.      ──────────────────────────────────────────────────────────────────────
  1363.  
  1364.      ■  Summary
  1365.  
  1366.      capture(str <filename>);
  1367.  
  1368.      ■  Description
  1369.  
  1370.      The capture function is used to open, close, pause, and unpause the
  1371.      Telix capture file. Depending on what the string variable <filename>
  1372.      contains, different actions will take place.
  1373.  
  1374.      If <filename> contains a valid filename (which can include a path),
  1375.      Telix opens and starts capturing data to that file.
  1376.  
  1377.      If <filename> is "*CLOSE*", and the capture file is currently open, it
  1378.      is closed.
  1379.  
  1380.      If <filename> is "*PAUSE*", and the capture file is currently open, it
  1381.      is paused.
  1382.  
  1383.      if <filename> is "*UNPAUSE*", and the capture file is currently open
  1384.      and paused, it is unpaused.
  1385.  
  1386.      If <filename> is an empty string (""), Telix takes the same action as
  1387.      if the user had pressed Alt-L while in terminal mode (which will de-
  1388.      pend on whether the capture file is currently open or closed).
  1389.  
  1390.      ■  Return Value
  1391.  
  1392.      A value of -1 is returned if there is a problem performing the indi-
  1393.      cated function, otherwise a non-zero (TRUE) value is returned.
  1394.  
  1395.      ■  See Also
  1396.  
  1397.      printer, capture_stat, _capture_fname
  1398.      Telix v3.5x - SALT Programming                Built-in Functions    25
  1399.  
  1400.  
  1401.  
  1402.      ■  Example
  1403.  
  1404.      if (capture("TELIX.CAP") == -1)
  1405.       prints("Error opening capture file!");
  1406.         ...
  1407.      capture("*PAUSE*");
  1408.      capture("*UNPAUSE*");
  1409.      capture("*CLOSE*");
  1410.  
  1411.  
  1412.  
  1413.  
  1414.      CAPTURE_STAT
  1415.      ──────────────────────────────────────────────────────────────────────
  1416.  
  1417.      ■  Summary
  1418.  
  1419.      capture_stat();
  1420.  
  1421.      ■  Description
  1422.  
  1423.      The capture_stat function returns an integer value representing the
  1424.      current status of the capture file, as follows:
  1425.  
  1426.                0    Capture File is closed
  1427.                1    Capture File is open
  1428.                2    Capture File is open and paused
  1429.  
  1430.      ■  Return Value
  1431.  
  1432.      An integer values as described above.
  1433.  
  1434.      ■  See Also
  1435.  
  1436.      capture, usage_stat
  1437.  
  1438.  
  1439.  
  1440.  
  1441.      CARRIER
  1442.      ──────────────────────────────────────────────────────────────────────
  1443.  
  1444.      ■  Summary
  1445.  
  1446.      carrier();
  1447.  
  1448.      ■  Description
  1449.  
  1450.      The carrier functions returns a non-zero (TRUE) value if the Carrier
  1451.      Detect signal coming from the modem is on (high), otherwise it returns
  1452.      a zero (FALSE) value. Note that some modems by default override the
  1453.      real state of the signal and always send a high. For this function to
  1454.      work, the modem must be told to supply the real signal. This function
  1455.      may be used to check if Telix is connected to a remote service over
  1456.      the modem, as the Carrier Detect signal should be on if there is a
  1457.      connection. Note that if you are connecting two computers via a null-
  1458.      Telix v3.5x - SALT Programming                Built-in Functions    26
  1459.  
  1460.  
  1461.  
  1462.      modem cable, the value returned will depend on the wiring of the cable
  1463.      being used.
  1464.  
  1465.      ■  Return Value
  1466.  
  1467.      non-zero (TRUE) or zero (FALSE) based on the state of the Carrier De-
  1468.      tect signal.
  1469.  
  1470.      ■  Example
  1471.  
  1472.      if (carrier())
  1473.       prints("We are online.");
  1474.  
  1475.  
  1476.      CGETC, CGETCT
  1477.      ──────────────────────────────────────────────────────────────────────
  1478.  
  1479.      ■  Summary
  1480.  
  1481.      cgetc();
  1482.  
  1483.      cgetct(int <timeout>);
  1484.  
  1485.      ■  Description
  1486.  
  1487.      The cgetc function returns the first character waiting in the received
  1488.      data communications buffer. If there are no characters in the buffer,
  1489.      a value of -1 is returned. The cinp_cnt function may be used to see if
  1490.      there are any chars waiting in the buffer.
  1491.  
  1492.      The cgetct functions returns a character from the communications port,
  1493.      waiting up to <timeout> tenths of a second for it to arrive. If a
  1494.      character is already waiting in the communications buffer, it is imme-
  1495.      diately returned. If no character is received within the timeout pe-
  1496.      riod, a value of -1 is returned.
  1497.  
  1498.      ■  Return Value
  1499.  
  1500.      An integer value as described above.
  1501.  
  1502.      ■  See Also
  1503.  
  1504.      cinp_cnt
  1505.  
  1506.      ■  Example
  1507.  
  1508.      if (cinp_cnt())
  1509.       chr = cgetc();
  1510.      if ((chr = cgetct(100)) == -1)
  1511.       prints("Timeout!");
  1512.      Telix v3.5x - SALT Programming                Built-in Functions    27
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.      CHATMODE
  1520.      ──────────────────────────────────────────────────────────────────────
  1521.  
  1522.      ■  Summary
  1523.  
  1524.      chatmode(int <echo_remote>);
  1525.  
  1526.      ■  Description
  1527.  
  1528.      The chatmode function enters the chat mode as if the user had pressed
  1529.      Alt-Y while in terminal mode, If <echo_remote> is non-zero (TRUE),
  1530.      characters typed by the remote user are echoed back to him/her, other-
  1531.      wise they are not. The echo feature is for use in Host Mode
  1532.      implementations.
  1533.  
  1534.      ■  Return Value
  1535.  
  1536.      None.
  1537.  
  1538.  
  1539.  
  1540.  
  1541.      CINP_CNT
  1542.      ──────────────────────────────────────────────────────────────────────
  1543.  
  1544.      ■  Summary
  1545.  
  1546.      cinp_cnt();
  1547.  
  1548.      ■  Description
  1549.  
  1550.      The cinp_cnt function returns the number of characters waiting in the
  1551.      received data communications buffer.
  1552.  
  1553.      ■  Return Value
  1554.  
  1555.      An integer value as described above.
  1556.  
  1557.      ■  See Also
  1558.  
  1559.      cgetc
  1560.  
  1561.      ■  Examples
  1562.  
  1563.      if (cinp_cnt() > 10)   // if more than 10 chars waiting
  1564.       handle_stuff();       //   do action
  1565.      while (!cinp_cnt())    // loop until no chars available
  1566.       ;
  1567.      if (cinp_cnt())        // if something available, get it
  1568.       c = cgetc();
  1569.      Telix v3.5x - SALT Programming                Built-in Functions    28
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.      CLEAR_SCR
  1577.      ──────────────────────────────────────────────────────────────────────
  1578.  
  1579.      ■  Summary
  1580.  
  1581.      clear_scr();
  1582.  
  1583.      ■  Description
  1584.  
  1585.      The clear_scr function clears the screen and places the cursor in the
  1586.      upper left corner at position 0,0.
  1587.  
  1588.      ■  Return Value
  1589.  
  1590.      None.
  1591.  
  1592.      ■  See Also
  1593.  
  1594.      scroll
  1595.  
  1596.  
  1597.  
  1598.  
  1599.      COPYCHRS
  1600.      ──────────────────────────────────────────────────────────────────────
  1601.  
  1602.      ■  Summary
  1603.  
  1604.      copychrs(str <source>, str <target>, int <pos>, int <count>);
  1605.  
  1606.      ■  Description
  1607.  
  1608.      The copychrs function copies a number of characters from one string
  1609.      into another, Characters from the string <source> are copied into the
  1610.      string <target> at the position <pos> (note that SALT string offsets
  1611.      start at 0, not 1 as in some languages). until <count> characters are
  1612.      copied. Only as many characters as will fit in <target> are copied.
  1613.  
  1614.      This function is very similar to substr, except that it is not string
  1615.      oriented, and does not stop copying characters when a 0 value is en-
  1616.      countered.
  1617.  
  1618.      The substr function copies a portion of one string to another. Char-
  1619.      acters from position <pos> in string <source> are copied until into
  1620.      string <target> (note that SALT string offsets start at 0, not 1 as in
  1621.      some languages). Characters are copied until a 0 (NULL) value is en-
  1622.      countered (normally at the end of every string), or <max> characters
  1623.      are copied. A 0 (NULL) is always copied at the end of the target
  1624.      string. The 0 does not count as part of the <max>. Only as many char-
  1625.      acters as will fit in <target> are copied.
  1626.  
  1627.      ■  Return Value
  1628.  
  1629.      None.
  1630.      Telix v3.5x - SALT Programming                Built-in Functions    29
  1631.  
  1632.  
  1633.  
  1634.      ■  See Also
  1635.  
  1636.      copystr, subchrs, substr
  1637.  
  1638.  
  1639.  
  1640.  
  1641.      COPYSTR
  1642.      ──────────────────────────────────────────────────────────────────────
  1643.  
  1644.      ■  Summary
  1645.  
  1646.      copystr(str <source>, str <target>, int <pos>, int <count>);
  1647.  
  1648.      ■  Description
  1649.  
  1650.      The copystr function copies one string into another at a certain po-
  1651.      sition. Characters in string <source> are copied into string <target>
  1652.      at position <pos> (note that SALT string offsets start at 0, not 1 as
  1653.      in some languages). Characters are copied until a 0 (NULL) value is
  1654.      encountered (normally at the end of every string), or <max> characters
  1655.      are copied. A 0 (NULL) is always copied at the end of the target
  1656.      string. The 0 does not count as part of the <max>. Only as many char-
  1657.      acters as will fit in <target> are copied.
  1658.  
  1659.      ■  Return Value
  1660.  
  1661.      None.
  1662.  
  1663.      ■  See Also
  1664.  
  1665.      copychrs, substr, subchrs
  1666.  
  1667.  
  1668.  
  1669.  
  1670.      CPUTC
  1671.      ──────────────────────────────────────────────────────────────────────
  1672.  
  1673.      ■  Summary
  1674.  
  1675.      cputc(int <character>);
  1676.  
  1677.      ■  Description
  1678.  
  1679.      The cputc function sends <character> to the communications port. This
  1680.      is the ASCII value of the character to be sent.
  1681.  
  1682.      ■  Return Value
  1683.  
  1684.      A non-zero (TRUE) value is returned unless the character can not be
  1685.      sent for some reason, in which case a value of -1 is returned.
  1686.  
  1687.      ■  See Also
  1688.  
  1689.      cputs
  1690.      Telix v3.5x - SALT Programming                Built-in Functions    30
  1691.  
  1692.  
  1693.  
  1694.      ■  Example
  1695.  
  1696.      cputc('A');
  1697.      cputc(27);          // send Escape to the comm port
  1698.      cputc('^M');        // send Ctrl-M (Carriage Return)
  1699.      cputc(inkeyw());
  1700.  
  1701.  
  1702.  
  1703.  
  1704.      CPUTS
  1705.      ──────────────────────────────────────────────────────────────────────
  1706.  
  1707.      ■  Summary
  1708.  
  1709.      cputs(str <outstr>);
  1710.  
  1711.      ■  Description
  1712.  
  1713.      The cputs function sends the passed string out over the modem port. A
  1714.      Carriage Return and Line Feed are NOT added after the string.
  1715.  
  1716.      ■  Return Value
  1717.  
  1718.      None.
  1719.  
  1720.      ■  See Also
  1721.  
  1722.      cputs_tr
  1723.  
  1724.      ■  Example
  1725.  
  1726.      cputs("Good-bye");
  1727.      str password[] = "mypass";
  1728.      cputs(password);
  1729.  
  1730.  
  1731.  
  1732.  
  1733.      CPUTS_TR
  1734.      ──────────────────────────────────────────────────────────────────────
  1735.  
  1736.      ■  Summary
  1737.  
  1738.      cputs_tr(str <outstr>);
  1739.  
  1740.      ■  Description
  1741.  
  1742.      The cputs_tr function sends the passed string out over the modem port,
  1743.      but pays attention to two output string translation characters,  ^ and
  1744.      ~, described in the Telix manual. This function is really only useful
  1745.      for sending the modem control strings that the user has defined in the
  1746.      Configuration Menu.
  1747.  
  1748.      ■  Return Value
  1749.  
  1750.      None.
  1751.      Telix v3.5x - SALT Programming                Built-in Functions    31
  1752.  
  1753.  
  1754.  
  1755.      ■  See Also
  1756.  
  1757.      cputs
  1758.  
  1759.      ■  Example
  1760.  
  1761.      cputs_tr(_modem_init);
  1762.      cputs_tr("good-bye~yes^M");
  1763.  
  1764.  
  1765.  
  1766.  
  1767.      CURSOR_ONOFF
  1768.      ──────────────────────────────────────────────────────────────────────
  1769.  
  1770.      ■  Summary
  1771.  
  1772.      cursor_onoff(int <state>);
  1773.  
  1774.      ■  Description
  1775.  
  1776.      The cursor_onoff functions turn the blinking cursor on or off (makes
  1777.      it disappear or reappear), depending on whether state is non-zero
  1778.      (TRUE) or zero (FALSE).
  1779.  
  1780.      ■  Return Value
  1781.  
  1782.      None.
  1783.  
  1784.  
  1785.  
  1786.  
  1787.      CURTIME
  1788.      ──────────────────────────────────────────────────────────────────────
  1789.  
  1790.      ■  Summary
  1791.  
  1792.      curtime();
  1793.  
  1794.      ■  Description
  1795.  
  1796.      The curtime function returns the current date/time as the number of
  1797.      seconds since Jan 1, 1970. A date/time value in this format is used by
  1798.      many SALT functions.
  1799.  
  1800.      ■  Return Value
  1801.  
  1802.      An integer value as described above.
  1803.  
  1804.      ■  See Also
  1805.  
  1806.      date, time, tyear, tmonth, tday, thour, tmin, tsec
  1807.  
  1808.      ■  Example
  1809.  
  1810.      // Print the current date
  1811.      Telix v3.5x - SALT Programming                Built-in Functions    32
  1812.  
  1813.  
  1814.  
  1815.      int t;
  1816.      str s[64];
  1817.  
  1818.      t = curtime();
  1819.      date(t, s);
  1820.      prints(s);
  1821.  
  1822.  
  1823.  
  1824.  
  1825.      DATE
  1826.      ──────────────────────────────────────────────────────────────────────
  1827.  
  1828.      ■  Summary
  1829.  
  1830.      date(int <timeval>, str <buffer>);
  1831.  
  1832.      ■  Description
  1833.  
  1834.      The date function writes out a date in <buffer> in the form mm/dd/yy,
  1835.      dd/mm/yy, or yy/mm/dd (which is based on the system variable
  1836.      _date_format). <timeval> is the date, represented as the number of
  1837.      seconds since Jan 1, 1970. Time values in this form are returned by
  1838.      the curtime and filetime functions, among others.
  1839.  
  1840.      ■  Return Value
  1841.  
  1842.      None.
  1843.  
  1844.      ■  See Also
  1845.  
  1846.      time, curtime, filetime
  1847.  
  1848.      ■  Example
  1849.  
  1850.      str s[16];
  1851.      printsc("The current date is ");
  1852.      date(curtime(), s);
  1853.      prints(s);
  1854.  
  1855.  
  1856.      DELAY, DELAY_SCR
  1857.      ──────────────────────────────────────────────────────────────────────
  1858.  
  1859.      ■  Summary
  1860.  
  1861.      delay(int <duration>);
  1862.  
  1863.      delay_scr(int <duration>);
  1864.  
  1865.      ■  Description
  1866.  
  1867.      The delay function pauses Telix for a length of time specified in
  1868.      tenths of a second by <duration>. During this pause, everything is
  1869.      shut off except the asynchronous reception of characters from the comm
  1870.      port.
  1871.      Telix v3.5x - SALT Programming                Built-in Functions    33
  1872.  
  1873.  
  1874.  
  1875.      The delay_scr function pauses only the execution of the current script
  1876.      file for the indicated duration. During that time, characters coming
  1877.      in from the serial port are printed on the terminal screen, while user
  1878.      keystrokes are also processed.
  1879.  
  1880.      ■  Return Value
  1881.  
  1882.      The <duration> argument is returned.
  1883.  
  1884.  
  1885.  
  1886.  
  1887.      DELCHRS
  1888.      ──────────────────────────────────────────────────────────────────────
  1889.  
  1890.      ■  Summary
  1891.  
  1892.      delchrs(str <s>, int <pos>, int <num>);
  1893.  
  1894.      ■  Description
  1895.  
  1896.      The delchrs function is used to remove or delete a number of charac-
  1897.      ters in a string at a certain position. <s> is the string to handle.
  1898.      <pos> is the position at which <num> characters will be deleted (note
  1899.      that the first characters in a SALT string has the position 0). Re-
  1900.      maining characters in the string are be shifted left.
  1901.  
  1902.      ■  Return Value
  1903.  
  1904.      None.
  1905.  
  1906.      ■  See Also
  1907.  
  1908.      inschrs
  1909.  
  1910.      ■  Example
  1911.  
  1912.      // remove all but the first and last characters in a string
  1913.  
  1914.      str s[] = "0123456789";
  1915.      delchrs(s, 1, strlen(s) - 2);
  1916.  
  1917.  
  1918.  
  1919.  
  1920.      DIAL
  1921.      ──────────────────────────────────────────────────────────────────────
  1922.  
  1923.      ■  Summary
  1924.  
  1925.      dial(str <dialstr>, int <maxtries>, int <no_link>);
  1926.  
  1927.      ■  Description
  1928.  
  1929.      The dial function dials the entries specified in <dialstr>. The en-
  1930.      tries should be entered in the same format as used when typing entries
  1931.      in the dialing directory. If <dialstr> is empty (""), the dialing di-
  1932.      Telix v3.5x - SALT Programming                Built-in Functions    34
  1933.  
  1934.  
  1935.  
  1936.      rectory is displayed. <maxtries> is the maximum number of dialing at-
  1937.      tempts. For example, if the string contains one entry, and <maxtries>
  1938.      is equal to 5, Telix will attempt to dial the number 5 times. If five
  1939.      entries are indicated, and <maxtries> is equal to 5, each number will
  1940.      only be attempted once.  If <maxtries> is 0, dialing will continue un-
  1941.      til a connection is established. If an entry is connected to, and has
  1942.      a linked script file attached, that script will be run, unless
  1943.      <no_link> is non-zero (TRUE).
  1944.  
  1945.      ■  Return Value
  1946.  
  1947.      If there was a connection, the dial function returns the entry number
  1948.      of the entry which was connected to (or 1 if a manual number was di-
  1949.      aled). If there was no connection established, 0 is returned. If the
  1950.      <dialstr> has a bad format, -1 is returned.
  1951.  
  1952.      Also, when a connection is successfully established, the entry number
  1953.      of the entry connected to is placed in the system variable
  1954.      _entry_enum, while the name of the entry connected to is placed in the
  1955.      system variable _entry_name.
  1956.  
  1957.      ■  See Also
  1958.  
  1959.      redial
  1960.      _entry_enum, _entry_name
  1961.  
  1962.      ■  Example
  1963.  
  1964.      int stat;
  1965.      dial("10 15", 0);
  1966.      dial("m967-1111", 5);
  1967.      stat = dial(number_list, 0);
  1968.  
  1969.  
  1970.  
  1971.  
  1972.      DOS
  1973.      ──────────────────────────────────────────────────────────────────────
  1974.  
  1975.      ■  Summary
  1976.  
  1977.      dos(str <command>, int <mode>);
  1978.  
  1979.      ■  Description
  1980.  
  1981.      The dos function calls the DOS command interpreter (usually COM-
  1982.      MAND.COM, and gives it the passed command string. If the <command>
  1983.      string is empty (""), Telix will drop into a DOS shell, as if the Alt-
  1984.      J command had been executed. Make sure that if you specify a command
  1985.      or program that expects user input you are on hand to give it. The
  1986.      <mode> argument specifies several options, as follows:
  1987.  
  1988.           0    Original screen is restored when command is completed.
  1989.           1    When command is completed, the user is prompted to press a
  1990.                key and screen is restored as soon as it is pressed.
  1991.           2    Original screen is not restored when command is completed
  1992.      Telix v3.5x - SALT Programming                Built-in Functions    35
  1993.  
  1994.  
  1995.  
  1996.      This function is very similar to the run function. It should be used
  1997.      when an internal DOS command is needed or a DOS shell is needed, oth-
  1998.      erwise run is preferable as it uses less memory and executes faster.
  1999.  
  2000.      ■  Return Value
  2001.  
  2002.      The dos function returns a -1 if the command processor can not be
  2003.      found or there is not enough memory to load it, otherwise a 0 is re-
  2004.      turned.
  2005.  
  2006.      ■  See Also
  2007.  
  2008.      run, dosfunction
  2009.  
  2010.      ■  Example
  2011.  
  2012.      dos("copy a:*.* c:", 1);
  2013.  
  2014.  
  2015.  
  2016.  
  2017.      DOSFUNCTION
  2018.      ──────────────────────────────────────────────────────────────────────
  2019.  
  2020.      ■  Summary
  2021.  
  2022.      dosfunction();
  2023.  
  2024.      ■  Description
  2025.  
  2026.      The dosfunction function calls up the 'DOS Functions' menu, as if the
  2027.      user had pressed Alt-F while in terminal mode.
  2028.  
  2029.      ■  Return Value
  2030.  
  2031.      None.
  2032.  
  2033.      ■  See Also
  2034.  
  2035.      dos, run
  2036.  
  2037.  
  2038.  
  2039.  
  2040.      EXITTELIX
  2041.      ──────────────────────────────────────────────────────────────────────
  2042.  
  2043.      ■  Summary
  2044.  
  2045.      exittelix(int <returncode>, int <hangup>);
  2046.  
  2047.      ■  Description
  2048.  
  2049.      The exittelix function closes any currently open log file, and exits
  2050.      Telix to DOS, as if the user had pressed Alt-X while in terminal mode.
  2051.      The <returncode> argument is the value that should be returned to DOS.
  2052.      This value can be read by whatever called Telix (e.g., a batch file
  2053.      Telix v3.5x - SALT Programming                Built-in Functions    36
  2054.  
  2055.  
  2056.  
  2057.      using the errorlevel command). The <hangup> option affects what hap-
  2058.      pens if Telix is online. If it is set to non-zero (TRUE), Telix will
  2059.      hang-up before returning to DOS, otherwise the connection will not be
  2060.      disturbed.
  2061.  
  2062.      ■  Return Value
  2063.  
  2064.      Since this functions causes Telix to terminate, there is never any re-
  2065.      turn from it.
  2066.  
  2067.      ■  Example
  2068.  
  2069.      exittelix(0, 1);
  2070.      exittelix(100, 0);
  2071.  
  2072.  
  2073.      FCLEARERR
  2074.      ──────────────────────────────────────────────────────────────────────
  2075.  
  2076.      ■  Summary
  2077.  
  2078.      fclearerr(int <fh>);
  2079.  
  2080.      ■  Description
  2081.  
  2082.      The fclearerr function clears the error flag assigned to the open file
  2083.      represented by file handle <fh>. It also clears the End Of File flag
  2084.      for that file as well.
  2085.  
  2086.      ■  Return Value
  2087.  
  2088.      None.
  2089.  
  2090.      ■  See Also
  2091.  
  2092.      ferror, feof
  2093.  
  2094.      ■  Example
  2095.  
  2096.      int f;
  2097.      f = fopen("test.dat", "r");
  2098.         ...
  2099.      if (ferror(f))
  2100.       fclearerr(f);
  2101.  
  2102.  
  2103.      FCLOSE
  2104.      ──────────────────────────────────────────────────────────────────────
  2105.  
  2106.      ■  Summary
  2107.  
  2108.      fclose(int <fh>);
  2109.  
  2110.      ■  Description
  2111.  
  2112.      The fclose functions closes the file represented by the file handle
  2113.      <fh>, which must previously been opened for reading or writing with
  2114.      Telix v3.5x - SALT Programming                Built-in Functions    37
  2115.  
  2116.  
  2117.  
  2118.      the fopen function. If the file was opened for writing, any data which
  2119.      is still buffered and waiting to be written out to disk is written be-
  2120.      fore the file is closed.
  2121.  
  2122.      ■  Return Value
  2123.  
  2124.      A return value of -1 indicates a problem closing the file.
  2125.  
  2126.      ■  See Also
  2127.  
  2128.      fopen
  2129.  
  2130.      ■  Example
  2131.  
  2132.      int f;
  2133.      f = fopen("test.dat", "w");
  2134.         ...
  2135.      fclose(f);
  2136.  
  2137.  
  2138.      FDELETE
  2139.      ──────────────────────────────────────────────────────────────────────
  2140.  
  2141.      ■  Summary
  2142.  
  2143.      fdelete(str <filename>);
  2144.  
  2145.      ■  Description
  2146.  
  2147.      The fdelete function is used to delete a disk file from within a
  2148.      script. <filename> is the name of the file to delete. A full drive and
  2149.      path may be specified as part of the filename, and case is not signif-
  2150.      icant, but wildcard characters (* or ?) may NOT be part of the file-
  2151.      name.
  2152.  
  2153.      ■  Return Value
  2154.  
  2155.      A value of -1 is returned if there is a problem deleting the file, 0
  2156.      otherwise.
  2157.  
  2158.      ■  See Also
  2159.  
  2160.      frename
  2161.  
  2162.      ■  Example
  2163.  
  2164.      fdelete("C:\UTIL\TLX\TELIX.CAP");    // delete an old capture file
  2165.  
  2166.  
  2167.  
  2168.  
  2169.      FEOF
  2170.      ──────────────────────────────────────────────────────────────────────
  2171.  
  2172.      ■  Summary
  2173.  
  2174.      feof(int <fh>);
  2175.      Telix v3.5x - SALT Programming                Built-in Functions    38
  2176.  
  2177.  
  2178.  
  2179.      ■  Description
  2180.  
  2181.      The feof function determines if the file position for the open file
  2182.      represented by the file handle <fh> is at the end-of-file position.
  2183.  
  2184.      ■  Return Value
  2185.  
  2186.      A non-zero (TRUE) value is returned if the file position is at the end
  2187.      of the file.
  2188.  
  2189.      ■  See Also
  2190.  
  2191.      ferror
  2192.  
  2193.      ■  Example
  2194.  
  2195.      int f, chr;
  2196.      f = fopen("test.dat", "r");
  2197.      while ((chr = fgetc(f)) != -1)    // print contents of file
  2198.       printc(chr);
  2199.      if (feof(f))
  2200.       prints("Reached end of file.");
  2201.      else
  2202.       prints("Error reading file");
  2203.  
  2204.  
  2205.      FERROR
  2206.      ──────────────────────────────────────────────────────────────────────
  2207.  
  2208.      ■  Summary
  2209.  
  2210.      ferror(int <fh>);
  2211.  
  2212.      ■  Description
  2213.  
  2214.      The ferror function checks the error flag for a file represented by
  2215.      the file handle <fh>. The error flag stays set until it is cleared
  2216.      with fclearerr or the file is closed.
  2217.  
  2218.      ■  Return Value
  2219.  
  2220.      A non-zero (TRUE) value is returned if the file's error flag is set.
  2221.  
  2222.      ■  See Also
  2223.  
  2224.      fclearerr, feof
  2225.  
  2226.      ■  Example
  2227.  
  2228.      int f;
  2229.      f = fopen("test.dat", "r");       // open file only for reading
  2230.      fputs("This should set the error flag!", f);
  2231.      if (ferror(f))
  2232.       prints("Error writing to file!");
  2233.      Telix v3.5x - SALT Programming                Built-in Functions    39
  2234.  
  2235.  
  2236.  
  2237.      FFLUSH
  2238.      ──────────────────────────────────────────────────────────────────────
  2239.  
  2240.      ■  Summary
  2241.  
  2242.      fflush(int <fh>);
  2243.  
  2244.      ■  Description
  2245.  
  2246.      The fflush function flushes the buffer associated with the file rep-
  2247.      resented by file handle <fh>. If the file is opened for writing, any
  2248.      characters in the buffer are written. If the file is opened for read-
  2249.      ing, the buffer is cleared.
  2250.  
  2251.      ■  Return Value
  2252.  
  2253.      A value of -1 is returned if there is a problem flushing the buffer.
  2254.  
  2255.      ■  See Also
  2256.  
  2257.      fopen, fclose
  2258.  
  2259.  
  2260.      FGETC
  2261.      ──────────────────────────────────────────────────────────────────────
  2262.  
  2263.      ■  Summary
  2264.  
  2265.      fgetc(int <fh>);
  2266.  
  2267.      ■  Description
  2268.  
  2269.      The fgetc function returns the next character from the file rep-
  2270.      resented by the file handle <fh>. The file must have been opened for
  2271.      reading or from reading and writing, using the fopen function.
  2272.  
  2273.      ■  Return Value
  2274.  
  2275.      Returns the character read if successful, or -1 if the end of the file
  2276.      has been reached or an error is encountered.
  2277.  
  2278.      ■  See Also
  2279.  
  2280.      fopen, fputc
  2281.  
  2282.      ■  Example
  2283.  
  2284.      int f;
  2285.      f = fopen("test.dat", "r");
  2286.      while (!feof(f))        // print all the characters in the file
  2287.       printc(fgetc(f));
  2288.      Telix v3.5x - SALT Programming                Built-in Functions    40
  2289.  
  2290.  
  2291.  
  2292.      FGETS
  2293.      ──────────────────────────────────────────────────────────────────────
  2294.  
  2295.      ■  Summary
  2296.  
  2297.      fgets(str <buffer>, int <n>, int <fh>);
  2298.  
  2299.      ■  Description
  2300.  
  2301.      The fgets function reads characters from the open file indicated by
  2302.      the file handle <fh> into the string variable <buffer>. Reading stops
  2303.      when a newline (Line Feed) character is read, and end-of-file is en-
  2304.      countered, a read error occurs, or <n> characters have been read. The
  2305.      Line Feed character (and the Carriage Return that usually precedes it
  2306.      on MS-DOS systems) is not kept as part of the string.
  2307.  
  2308.      Important: The SALT implementation of the fgets() function differs
  2309.      from the C language function of the same name. While both implemen-
  2310.      tations read until the Line Feed character, C keeps that character as
  2311.      part of the input string, while SALT doesn't. This change was made be-
  2312.      cause in almost every case, the Line Feed is not needed, and would
  2313.      otherwise have to be manually stripped by the script after every read.
  2314.  
  2315.      ■  Return Value
  2316.  
  2317.      A value of -1 is returned if there is a read error, or if there is an
  2318.      end-of-file before any characters can be read.
  2319.  
  2320.      ■  See Also
  2321.  
  2322.      fopen, fputs
  2323.  
  2324.      ■  Example
  2325.  
  2326.      int f;
  2327.      str s[100];
  2328.      f = fopen("test.dat", "r");
  2329.      while (!feof(f))         // print out contents of text file
  2330.       {
  2331.        fgets(s, 100, f);
  2332.        printsc(s);
  2333.       }
  2334.  
  2335.  
  2336.      FILEATTR
  2337.      ──────────────────────────────────────────────────────────────────────
  2338.  
  2339.      ■  Summary
  2340.  
  2341.      fileattr(str <filespec>);
  2342.  
  2343.      ■  Description
  2344.  
  2345.      Under the MS-DOS file system, files have a certain attributes which
  2346.      can determine their functions or the way certain things behave. For
  2347.      example if a file has the 'hidden' bit set as part of its attribute
  2348.      Telix v3.5x - SALT Programming                Built-in Functions    41
  2349.  
  2350.  
  2351.  
  2352.      byte, when you do a DOS dir command, the file is not shown. Similarly,
  2353.      if a file has the read only bit set, you may not overwrite it.
  2354.  
  2355.      The fileattr function returns an integer value representing the at-
  2356.      tributes of a specified file. <filespec> is the name of the file and
  2357.      may include a drive and directory portion, as well as the DOS wildcard
  2358.      characters * and ?.
  2359.  
  2360.      The value returned is a total of the following attributes.
  2361.  
  2362.           1    Read only file.
  2363.  
  2364.           2    Hidden file. The file is not listed when the DOS dir command
  2365.                is executed.
  2366.  
  2367.           4    System file. The file is not listed when the DOS dir command
  2368.                is executed.
  2369.  
  2370.           8    Volume label. This is the volume name of the disk.
  2371.  
  2372.           16   Subdirectory. This is a subdirectory name.
  2373.  
  2374.           32   Archive bit. This is set by DOS whenever a file has been
  2375.                written to and is then used by some backup software to check
  2376.                if a file has been modified since last backed-up.
  2377.  
  2378.      Each of these values is a certain bit in a byte. To test for the ex-
  2379.      istence of an attribute, the bitwise AND operator should be used. For
  2380.      example, the following fragment would check if the read only bit in an
  2381.      attribute is set:
  2382.  
  2383.      if (attrib & 1)
  2384.       ...
  2385.  
  2386.      If <filespec> is blank (""), then the attributes of the last file
  2387.      found with the filefind function is returned. Note that calling file-
  2388.      size or filetime in the meantime with a non-blank filename would in-
  2389.      stead make this call return the attributes of files found with those
  2390.      functions, as they use the same buffer.
  2391.  
  2392.      ■  Return Value
  2393.  
  2394.      An integer value representing the combined attributes of the indicated
  2395.      file is returned, or a value of -1 is returned if the indicated file
  2396.      could not be found.
  2397.  
  2398.      ■  See Also
  2399.  
  2400.      filefind, filesize, filetime
  2401.  
  2402.      ■  Example
  2403.  
  2404.      int attr;
  2405.      str filename[64];
  2406.      gets(filename, 64);
  2407.      attr = fileattr(filename);
  2408.      if (attr & 6)      // system _and_ hidden added together
  2409.      Telix v3.5x - SALT Programming                Built-in Functions    42
  2410.  
  2411.  
  2412.  
  2413.       prints("This file is marked as hidden and system");
  2414.  
  2415.  
  2416.      FILEFIND
  2417.      ──────────────────────────────────────────────────────────────────────
  2418.  
  2419.      ■  Summary
  2420.  
  2421.      filefind(str <filespec>, int <attrib>, str <buffer>);
  2422.  
  2423.      ■  Description
  2424.  
  2425.      The filefind function is used to search for the existence of one or
  2426.      more files or disk directories. Filefind puts in <buffer> the name of
  2427.      the first file matching <filespec>, which may include a drive and path
  2428.      as well as a filename, and may use the DOS wildcard characters * and ?
  2429.      (e.g., "*.*", "C:\TELIX\TELIX.EXE", "SCRIPTS\TEST??.*"). <attrib> is
  2430.      the attribute (also see fileattr) which files must match. The at-
  2431.      tribute is obtained by adding certain values as follows:
  2432.  
  2433.           0    Normal files and read only files
  2434.           2    Hidden files
  2435.           4    System files
  2436.           8    Disk volume label
  2437.           16   Subdirectory
  2438.  
  2439.      If the attribute is 0, only normal (and read-only) files are found. If
  2440.      the volume label is selected, only volume labels will be returned. Any
  2441.      other selected attribute or combination (addition) of attributes re-
  2442.      sults in those files and all normal files being matched.
  2443.  
  2444.      When a matching file, directory, or volume name is found, it is put in
  2445.      <buffer> (note that the drive and path portion of filespec are not
  2446.      copied), and a non-zero (TRUE) value is returned. The size, date/time,
  2447.      and attributes of the matched file can be seen with the filesize,
  2448.      filetime, and fileattr functions, respectively.  If no files matching
  2449.      the file specification are found, a zero (FALSE) value is returned.
  2450.  
  2451.      If <filespec> is blank (""), then filefind searches for the next
  2452.      matching file. Note that this will not work after an intervening call
  2453.      to filesize, filetime, or fileattr with a non-blank filename, as the
  2454.      same buffer is used for searches and to keep data.
  2455.  
  2456.      ■  Return Value
  2457.  
  2458.      A non-zero (TRUE) value is returned if a file matching the speci-
  2459.      fication was found, otherwise a value of zero (FALSE) is returned.
  2460.  
  2461.      ■  See Also
  2462.  
  2463.      filesize, filetime, fileattr
  2464.  
  2465.      ■  Example
  2466.  
  2467.      // show all normal files in the current directory
  2468.      str buf[16], fspec[16] = "*.*";
  2469.      while (filefind(fspec, 0, buf) != 0)
  2470.      Telix v3.5x - SALT Programming                Built-in Functions    43
  2471.  
  2472.  
  2473.  
  2474.       {
  2475.        prints(buf);    // show file found
  2476.        fspec = "";     // so we can continue searching for files
  2477.       }
  2478.  
  2479.  
  2480.      FILESIZE
  2481.      ──────────────────────────────────────────────────────────────────────
  2482.  
  2483.      ■  Summary
  2484.  
  2485.      filesize(str <filespec>);
  2486.  
  2487.      ■  Description
  2488.  
  2489.      The filesize function returns the size in bytes of the specified file.
  2490.      <filespec> is the name of the file and may include a drive and direc-
  2491.      tory portion, as well as the DOS wildcard characters * and ?.
  2492.  
  2493.      If <filespec> is blank (""), then the size of the last file found with
  2494.      the filefind function is returned. Note that calling filetime or
  2495.      fileattr in the meantime with a non-blank filename would instead make
  2496.      this call return the size of files found with those functions, as they
  2497.      use the same buffer.
  2498.  
  2499.      ■  Return Value
  2500.  
  2501.      An integer value representing the size of the indicated file is re-
  2502.      turned, or a value of -1 is returned if the indicated file could not
  2503.      be found.
  2504.  
  2505.      ■  See Also
  2506.  
  2507.      filefind, filetime, fileattr
  2508.  
  2509.      ■  Example
  2510.  
  2511.      str filespec[24] = "*.*", buf[12];
  2512.      int size;
  2513.      siz = filesize("TELIX.EXE");   // get size of file TELIX.EXE
  2514.      // Add up size of all files int he current directory
  2515.      siz = 0;
  2516.      while (filefind(filespec, 0, buf) != 0)   // until no more files
  2517.       {
  2518.        siz = siz + filesize("");   // get size of last filefound file
  2519.        filespec = "";              // make sure filespec is "" on sub-
  2520.                                    // sequent calls to filefind to
  2521.                                    // continue searching for files
  2522.       }
  2523.  
  2524.  
  2525.      FILETIME
  2526.      ──────────────────────────────────────────────────────────────────────
  2527.  
  2528.      ■  Summary
  2529.  
  2530.      filetime(str <filespec>);
  2531.      Telix v3.5x - SALT Programming                Built-in Functions    44
  2532.  
  2533.  
  2534.  
  2535.      ■  Description
  2536.  
  2537.      The filetime function returns the date/time of the specified file.
  2538.      <filespec> is the name of the file and may include a drive and di-
  2539.      rectory portion, as well as the DOS wildcard characters * and ?.
  2540.  
  2541.      The values returned represents the file's modification date as the
  2542.      number of seconds since Jan 1, 1970. A date/time in this form can be
  2543.      used by the date, time, tyear, tmonth, tday, thour, tmin, tsec, and
  2544.      other functions.
  2545.  
  2546.      If <filespec> is blank (""), then the date/time of the last file found
  2547.      with the filefind function is returned. Note that calling filesize or
  2548.      fileattr in the meantime with a non-blank filename would instead make
  2549.      this call return the time/date of files found with those functions, as
  2550.      they use the same buffer.
  2551.  
  2552.      ■  Return Value
  2553.  
  2554.      An integer value representing the date/time of the indicated file is
  2555.      returned, or a value of -1 is returned if the indicated file could not
  2556.      be found.
  2557.  
  2558.      ■  See Also
  2559.  
  2560.      filefind, filesize, fileattr
  2561.  
  2562.      ■  Example
  2563.  
  2564.      int time;
  2565.      str s[16];
  2566.  
  2567.      time = filetime("TELIX.EXE");
  2568.      if (time == -1)
  2569.       prints("'TELIX.EXE" could not be found!");
  2570.      else
  2571.       {
  2572.        printsc("TELIX.EXE was created at ");
  2573.        time(time, s);
  2574.        printsc(s);
  2575.        printsc(" on ");
  2576.        date(time, s);
  2577.        printsc(s);
  2578.       }
  2579.  
  2580.      // this example assumes both files exist
  2581.      if (filetime("FILE1") < filetime("FILE2"))
  2582.       prints("FILE1 is older than FILE2");
  2583.      else
  2584.       prints("FILE1 is newer than FILE2");
  2585.      Telix v3.5x - SALT Programming                Built-in Functions    45
  2586.  
  2587.  
  2588.  
  2589.      FLUSHBUF
  2590.      ──────────────────────────────────────────────────────────────────────
  2591.  
  2592.      ■  Summary
  2593.  
  2594.      flushbuf();
  2595.  
  2596.      ■  Description
  2597.  
  2598.      The flushbuf function flushes (throws away) any characters that may be
  2599.      waiting in Telix's remote input buffer. One use for this command is to
  2600.      get rid of unwanted line noise.
  2601.  
  2602.      ■  Return Value
  2603.  
  2604.      None.
  2605.  
  2606.  
  2607.      FNSTRIP
  2608.      ──────────────────────────────────────────────────────────────────────
  2609.  
  2610.      ■  Summary
  2611.  
  2612.      fnstrip(str <filename>, int <specifier>, str <target>);
  2613.  
  2614.      ■  Description
  2615.  
  2616.      The fnstrip function allows specific parts of a filename to be ex-
  2617.      tracted. In the MS-DOS operating system, a filename can consist of up
  2618.      to four parts, the drive, the path, the name, and the extension (e.g.,
  2619.      C:\TELIX\TELIX.FON). fnstrip processes the filename specified in
  2620.      <filename>, and depending on the value of <specifier>, places any com-
  2621.      bination of these four parts in the <target> string. Legal values for
  2622.      <specifier> and their results are as follows:
  2623.  
  2624.           <specifier>    Filename portion copied
  2625.  
  2626.                0         Full file name
  2627.                1         All except the drive
  2628.                2         Drive, name, and extension
  2629.                3         Name and extension
  2630.                4         Drive, path, and name (no extension)
  2631.                5         Path and name (no extension)
  2632.                6         Drive and name (no extension)
  2633.                7         Name only (no extension)
  2634.                12        Drive and path only
  2635.                13        Path only
  2636.                14        Drive only
  2637.  
  2638.      ■  Return Value
  2639.  
  2640.      None.
  2641.  
  2642.      ■  See Also
  2643.  
  2644.      filefind
  2645.      Telix v3.5x - SALT Programming                Built-in Functions    46
  2646.  
  2647.  
  2648.  
  2649.      ■  Example
  2650.  
  2651.      str filename[64], shortname[16];
  2652.      gets(filename, 64);                 // ask for a filename
  2653.      fnstrip(filename, 3, shortname);    // keep only name & extension
  2654.  
  2655.  
  2656.      FOPEN
  2657.      ──────────────────────────────────────────────────────────────────────
  2658.  
  2659.      ■  Summary
  2660.  
  2661.      fopen(str <name>, str <mode>);
  2662.  
  2663.      ■  Description
  2664.  
  2665.      The fopen function is used to open a disk file for reading and/or
  2666.      writing. The file to be opened is given by <name>. <mode> is a string
  2667.      indicating for what use the file should be opened. Legal values for
  2668.      mode are:
  2669.  
  2670.           "r"       Opens for reading
  2671.           "w"       Opens for writing (truncates any existing file with the
  2672.                     same name)
  2673.           "a"       Opens for appending (writing at the end of the file).
  2674.                     Creates the file if it doesn't exist.
  2675.           "r+"      Opens for reading and writing. Initial position at the
  2676.                     beginning of the file (the file must already exist).
  2677.           "w+"      Opens for reading and writing. If the file exists its
  2678.                     contents are destroyed.
  2679.           "a+"      Opens for reading and appending. Creates the file if it
  2680.                     doesn't exist.
  2681.  
  2682.      If a file is opened for both reading and writing (when "r+", "w+", or
  2683.      "a+" are used as the mode), an fseek operation is necessary before
  2684.      switching from one to the other.
  2685.  
  2686.      ■  Return Value
  2687.  
  2688.      The fopen function returns a 'handle' which is an integer number by
  2689.      which this file is to be referred to until it is finally closed. A
  2690.      value of 0 is returned if the file can not be opened (because it
  2691.      doesn't exist, because a disk error occurred, or because there are no
  2692.      more file handles available). Only up to 8 files may be opened at a
  2693.      time. It is therefore very important to close open files if they are
  2694.      no longer needed and when a script is done, or else all available file
  2695.      handles will become used up.
  2696.  
  2697.      ■  See Also
  2698.  
  2699.      fclose
  2700.  
  2701.      ■  Example
  2702.  
  2703.      int f;
  2704.      f = fopen("data.txt", "r");    // open the file for reading
  2705.      if (f == 0)
  2706.      Telix v3.5x - SALT Programming                Built-in Functions    47
  2707.  
  2708.  
  2709.  
  2710.       prints("Error opening file!");
  2711.  
  2712.  
  2713.      FPUTC
  2714.      ──────────────────────────────────────────────────────────────────────
  2715.  
  2716.      ■  Summary
  2717.  
  2718.      fputc(int <c>, int <fh>);
  2719.  
  2720.      ■  Description
  2721.  
  2722.      The fputc function writes a character to the file indicated by the
  2723.      file handle <fh>. <c> is the character to write.
  2724.  
  2725.      ■  Return Value
  2726.  
  2727.      The character written is returned, unless there is an error, in which
  2728.      case a value of -1 is returned.
  2729.  
  2730.      ■  See Also
  2731.  
  2732.      fputs, fgetc
  2733.  
  2734.      ■  Example
  2735.  
  2736.      int f, i;
  2737.      str teststr[] = "This is a test string";
  2738.      f = fopen("test.dat", "w");
  2739.      for (i = 0; i < 21; ++i)           // write out string to file
  2740.       fputc(subchr(teststr, i), f);     // character by character
  2741.  
  2742.  
  2743.      FPUTS
  2744.      ──────────────────────────────────────────────────────────────────────
  2745.  
  2746.      ■  Summary
  2747.  
  2748.      fputs(str <s>, int <fh>);
  2749.  
  2750.      ■  Description
  2751.  
  2752.      The fputs function writes a string to the file represented by file
  2753.      handle <fh>. The string must be 512 bytes in length or less (all
  2754.      strings end in a zero (0) value, the use of which is usually trans-
  2755.      parent; characters are written until this 0 is encountered. The 0 is
  2756.      not written).
  2757.  
  2758.      ■  Return Value
  2759.  
  2760.      A 0 value is returned if the write is successful, a non-zero value if
  2761.      it is not.
  2762.  
  2763.      ■  See Also
  2764.  
  2765.      fputc, fgets
  2766.      Telix v3.5x - SALT Programming                Built-in Functions    48
  2767.  
  2768.  
  2769.  
  2770.      ■  Example
  2771.  
  2772.      int f, i;
  2773.      f = fopen("test.dat", "w");
  2774.      for (i = 0; i < 100; ++i)      // write out "Hello" and a new-
  2775.       fputs("Hello^M^J", f);        // line one hundred times
  2776.  
  2777.  
  2778.      FREAD
  2779.      ──────────────────────────────────────────────────────────────────────
  2780.  
  2781.      ■  Summary
  2782.  
  2783.      fread(str <buf>, int <count>, int <fh>);
  2784.  
  2785.      ■  Description
  2786.  
  2787.      The fread function reads up to <count> bytes from the file represented
  2788.      by file handle <fh>. Characters are written to the <buf> variable,
  2789.      which must be large enough.
  2790.  
  2791.      ■  Return Value
  2792.  
  2793.      The number of bytes actually read is returned, which may be less than
  2794.      <count> if an error occurs or and end-of-file is encountered.
  2795.  
  2796.      The ferror and feof functions should be used to distinguish an error
  2797.      from an end-of-file condition.
  2798.  
  2799.      ■  See Also
  2800.  
  2801.      fwrite
  2802.  
  2803.      ■  Example
  2804.  
  2805.      int f;
  2806.      str buffer[40];
  2807.      f = fopen("test.dat", "r");
  2808.      fseek(f, 1000, 0);       // goto offset 1000 in file
  2809.      fread(buffer, 40, f);    // and read 40 bytes of data
  2810.  
  2811.  
  2812.      FRENAME
  2813.      ──────────────────────────────────────────────────────────────────────
  2814.  
  2815.      ■  Summary
  2816.  
  2817.      frename(str <oldname>, str <newname>);
  2818.  
  2819.      ■  Description
  2820.  
  2821.      The frename function is used to rename a disk file. <oldname> is the
  2822.      original name of the file, while <newname> is what it should be re-
  2823.      named to. A full drive and path may be included in the original name,
  2824.      but should not be placed before the new name. The renamed file will
  2825.      stay in the original drive and directory. Case is not significant.
  2826.      Telix v3.5x - SALT Programming                Built-in Functions    49
  2827.  
  2828.  
  2829.  
  2830.      ■  Return Value
  2831.  
  2832.      If successful, frename returns a 0 value, otherwise a non-zero value
  2833.      is returned.
  2834.  
  2835.      ■  See Also
  2836.  
  2837.      fdelete
  2838.  
  2839.      ■  Example
  2840.  
  2841.      frename("\TELIX\TELIX.CAP", "OLDTLX.CAP");
  2842.  
  2843.  
  2844.      FSEEK
  2845.      ──────────────────────────────────────────────────────────────────────
  2846.  
  2847.      ■  Summary
  2848.  
  2849.      fseek(int <fh>, int <offset>, int <origin>);
  2850.  
  2851.      ■  Description
  2852.  
  2853.      The fseek function sets the position of the file pointer in the file
  2854.      represented by the file handle <fh>. The file position is where the
  2855.      next read or write will take place. <offset> is the signed offset from
  2856.      the location specified by <origin>. Legal values for <origin> are:
  2857.  
  2858.           0:   Beginning of file.
  2859.           1:   Current position.
  2860.           2:   End of file.
  2861.  
  2862.      The pointer can be positioned anywhere in the file, and even past the
  2863.      end of the file (which will extend it). It is illegal to try to posi-
  2864.      tion the pointer before the beginning of the file however.
  2865.  
  2866.      ■  Return Value
  2867.  
  2868.      If successful, fseek returns a 0 value, otherwise a non-zero value is
  2869.      returned.
  2870.  
  2871.      ■  See Also
  2872.  
  2873.      ftell
  2874.  
  2875.      ■  Example
  2876.  
  2877.      int f;
  2878.      f = fopen("test.dat", "r");
  2879.      fseek(f, 0, 0);       // go to offset 0 in file
  2880.      fseek(f, 1000, 0);    // go to offset 1000 in file
  2881.      fseek(f, -5, 1);      // go back 5 places in file
  2882.      fseek(f, 0, 2);       // go to the end of the file
  2883.      Telix v3.5x - SALT Programming                Built-in Functions    50
  2884.  
  2885.  
  2886.  
  2887.      FTELL
  2888.      ──────────────────────────────────────────────────────────────────────
  2889.  
  2890.      ■  Summary
  2891.  
  2892.      ftell(int <fh>);
  2893.  
  2894.      ■  Description
  2895.  
  2896.      The ftell function returns the current file position in the file rep-
  2897.      resented by file handle <fh>. This is generally the position where the
  2898.      next read or write operation will take place. Note however that for a
  2899.      file opened in Append mode, the value returned will not necessarily
  2900.      return the position of the next write, since Append mode will force
  2901.      writes to the end of file regardless of the current file position.
  2902.  
  2903.      ■  Return Value
  2904.  
  2905.      An integer value as described above. A -1 value is returned if an er-
  2906.      ror occurs.
  2907.  
  2908.      ■  See Also
  2909.  
  2910.      fseek
  2911.  
  2912.  
  2913.      FWRITE
  2914.      ──────────────────────────────────────────────────────────────────────
  2915.  
  2916.      ■  Summary
  2917.  
  2918.      fwrite(str <buf>, int <count>, int <fh>);
  2919.  
  2920.      ■  Description
  2921.  
  2922.      The fwrite function writes bytes to the file represented by the file
  2923.      handle <fh>. <count> number of bytes are written from <buf>.
  2924.  
  2925.      ■  Return Value
  2926.  
  2927.      The number of bytes actually written are returned, which may be less
  2928.      than <count> if an error occurred.
  2929.  
  2930.      ■  See Also
  2931.  
  2932.      fread
  2933.  
  2934.      ■  Example
  2935.  
  2936.      int f;
  2937.      str buffer[] = "1234567890123456789012345";
  2938.      f = fopen("test.dat", "w");
  2939.      fwrite(buffer, 25, f);       // write test pattern to file
  2940.      Telix v3.5x - SALT Programming                Built-in Functions    51
  2941.  
  2942.  
  2943.  
  2944.      GET_BAUD
  2945.      ──────────────────────────────────────────────────────────────────────
  2946.  
  2947.      ■  Summary
  2948.  
  2949.      get_baud();
  2950.  
  2951.      ■  Description
  2952.  
  2953.      The get_baud function returns an integer value which is the current
  2954.      baud rate in use on the current communications port (300 through
  2955.      115200).
  2956.  
  2957.      ■  Return Value
  2958.  
  2959.      As described above.
  2960.  
  2961.      ■  See Also
  2962.  
  2963.      get_parity, get_datab, get_stopb, get_port
  2964.  
  2965.      ■  Example
  2966.  
  2967.      prints("The current baud rate is ");
  2968.      printn(get_baud());
  2969.      prints("");
  2970.  
  2971.  
  2972.      GET_DATAB
  2973.      ──────────────────────────────────────────────────────────────────────
  2974.  
  2975.      ■  Summary
  2976.  
  2977.      get_datab();
  2978.  
  2979.      ■  Description
  2980.  
  2981.      The get_datab function returns the data bits setting in use on the
  2982.      current communications port (7 or 8).
  2983.  
  2984.      ■  Return Value
  2985.  
  2986.      As described above.
  2987.  
  2988.      ■  See Also
  2989.  
  2990.      get_baud, get_parity, get_stopb, get_port
  2991.  
  2992.  
  2993.      GETENV
  2994.      ──────────────────────────────────────────────────────────────────────
  2995.  
  2996.      ■  Summary
  2997.  
  2998.      getenv(str <varname>, str <target>);
  2999.      Telix v3.5x - SALT Programming                Built-in Functions    52
  3000.  
  3001.  
  3002.  
  3003.      ■  Description
  3004.  
  3005.      The getenv function may be used to access the DOS Environment and get
  3006.      the value assigned to an Environment Variable. <varname> is the name
  3007.      of the environment variable to be searched for, and <target>  is the
  3008.      string variable where whatever is assigned to the environment variable
  3009.      should be placed.
  3010.  
  3011.      ■  Return Value
  3012.  
  3013.      A non-zero (TRUE) value is returned if the function is successful,
  3014.      otherwise a zero (FALSE) values is returned (if the environment vari-
  3015.      able didn't exist);
  3016.  
  3017.      ■  Example
  3018.  
  3019.      // Get and print whatever is assigned to the TELIX env. variable
  3020.      str value[64];
  3021.      if (getenv("TELIX", value))    // if env. variable exists
  3022.       prints(value);                // print value
  3023.  
  3024.  
  3025.      GET_PARITY
  3026.      ──────────────────────────────────────────────────────────────────────
  3027.  
  3028.      ■  Summary
  3029.  
  3030.      get_parity();
  3031.  
  3032.      ■  Description
  3033.  
  3034.      The get_parity function returns an integer value which represents the
  3035.      current parity setting in use on the current comm port.
  3036.  
  3037.      ■  Return Value
  3038.  
  3039.      Returned values are as follows:
  3040.  
  3041.                0    No parity
  3042.                1    Even parity
  3043.                2    Odd parity
  3044.  
  3045.      ■  See Also
  3046.  
  3047.      get_baud, get_datab, get_stopb, get_port
  3048.  
  3049.  
  3050.      GET_PORT
  3051.      ──────────────────────────────────────────────────────────────────────
  3052.  
  3053.      ■  Summary
  3054.  
  3055.      get_port();
  3056.      Telix v3.5x - SALT Programming                Built-in Functions    53
  3057.  
  3058.  
  3059.  
  3060.      ■  Description
  3061.  
  3062.      The get_port function returns the number (1 through 8) of the current
  3063.      communications port being used.
  3064.  
  3065.      ■  Return Value
  3066.  
  3067.      As described above.
  3068.  
  3069.      ■  See Also
  3070.  
  3071.      get_baud, get_datab, get_parity, get_stopb
  3072.  
  3073.      ■  Example
  3074.  
  3075.      prints("Currently using COM");
  3076.      printn(get_port());
  3077.      prints("");
  3078.  
  3079.  
  3080.      GET_STOPB
  3081.      ──────────────────────────────────────────────────────────────────────
  3082.  
  3083.      ■  Summary
  3084.  
  3085.      get_stopb();
  3086.  
  3087.      ■  Description
  3088.  
  3089.      The get_stopb function returns the stop bits setting in use on the
  3090.      current com port (1 or 2).
  3091.  
  3092.      ■  Return Value
  3093.  
  3094.       As described above.
  3095.  
  3096.      ■  See Also
  3097.  
  3098.      get_baud, get_datab, get_parity, get_port
  3099.  
  3100.  
  3101.      GETS
  3102.      ──────────────────────────────────────────────────────────────────────
  3103.  
  3104.      ■  Summary
  3105.  
  3106.      gets(str <buffer>, int <max>);
  3107.  
  3108.      ■  Description
  3109.  
  3110.      The gets function allows the user to enter a complete string, and use
  3111.      the arrow keys to edit it while it is being entered. <buffer> is the
  3112.      string variable where the string should be put, while <max> is the
  3113.      maximum number of characters the user may enter (from 0 to 80). The
  3114.      user may edit the string as it is being entered, with the Left-Arrow,
  3115.      Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it is being
  3116.      entered, and insert mode may be toggled on/off with the INS key.
  3117.      Telix v3.5x - SALT Programming                Built-in Functions    54
  3118.  
  3119.  
  3120.  
  3121.      String entry is over when the user presses Enter (Carriage Return on
  3122.      some computers). The user may press Esc to abort string entry, in
  3123.      which case the resulting string will have a length of 0.
  3124.  
  3125.      ■  Return Value
  3126.  
  3127.      The number of characters entered by the user are returned. If the user
  3128.      pressed Esc to abort string entry, a value of -1 is returned.
  3129.  
  3130.      ■  See Also
  3131.  
  3132.      getsxy
  3133.  
  3134.      ■  Example
  3135.  
  3136.      int n;
  3137.      str password[8];
  3138.      printsc("Enter a password? ");
  3139.      n = gets(password, 8);
  3140.  
  3141.      GETSXY
  3142.      ──────────────────────────────────────────────────────────────────────
  3143.  
  3144.      ■  Summary
  3145.  
  3146.      getsxy(str <targets>, int <max>, int <x>, int <y>, int <color>);
  3147.  
  3148.      ■  Description
  3149.  
  3150.      The getsxy function is similar to the gets function, but the x,y lo-
  3151.      cation of string entry may be specified, as well as a color attribute.
  3152.      <buffer> is the string variable where the string should be put, while
  3153.      <max> is the maximum number of characters the user may enter (from 0
  3154.      to 80). The cursor will be moved to <x>,<y>, and text entered will use
  3155.      a color as described by <color>.
  3156.  
  3157.      The user may edit the string as it is being entered, with the Left-Ar-
  3158.      row, Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it is
  3159.      being entered, and insert mode may be toggled on/off with the INS key.
  3160.      String entry is over when the user presses Enter (Carriage Return on
  3161.      some computers). The user may press Esc to abort string entry, in
  3162.      which case the resulting string will have a length of 0.
  3163.  
  3164.      ■  Return Value
  3165.  
  3166.      The number of characters entered by the user are returned. If the user
  3167.      pressed Esc to abort string entry, a value of -1 is returned.
  3168.  
  3169.      ■  See Also
  3170.  
  3171.      gets
  3172.  
  3173.      ■  Example
  3174.  
  3175.      int n;
  3176.      str filename[64] = "C:\TELIX\TELIX.EXE";
  3177.        // allow use to enter filename in black on white
  3178.      Telix v3.5x - SALT Programming                Built-in Functions    55
  3179.  
  3180.  
  3181.  
  3182.        // at current cursor position
  3183.      n = getsxy(filename, 64, getx(), gety(), 112);
  3184.  
  3185.  
  3186.      GETX, GETY
  3187.      ──────────────────────────────────────────────────────────────────────
  3188.  
  3189.      ■  Summary
  3190.  
  3191.      getx();
  3192.  
  3193.      gety();
  3194.  
  3195.      ■  Description
  3196.  
  3197.      The getx function returns the current column (horizontal x axis) po-
  3198.      sition of the cursor on the screen.
  3199.  
  3200.      The gety function returns the current row (vertical y axis) position
  3201.      of the cursor on the screen.
  3202.  
  3203.      ■  Return Value
  3204.  
  3205.      Returned values will range from 0 for the leftmost column to 79 for
  3206.      the rightmost column, for the getx function.
  3207.  
  3208.      Returned values range from 0 for the upper edge of the screen to 24
  3209.      for the lower edge, for the gety functions..
  3210.  
  3211.      ■  See Also
  3212.  
  3213.      gotoxy
  3214.  
  3215.  
  3216.      GOTOXY
  3217.      ──────────────────────────────────────────────────────────────────────
  3218.  
  3219.      ■  Summary
  3220.  
  3221.      gotoxy(int <xpos>, int <ypos>);
  3222.  
  3223.      ■  Description
  3224.  
  3225.      The gotoxy function positions the cursor at the screen coordinates
  3226.      given by <xpos> and <ypos>. Note that 0,0 is the upper left corner. On
  3227.      a 80x25 text screen, the lower right corner would be 79,24.
  3228.  
  3229.      ■  Return Value
  3230.  
  3231.      None.
  3232.  
  3233.      ■  See Also
  3234.  
  3235.      getx, gety
  3236.      Telix v3.5x - SALT Programming                Built-in Functions    56
  3237.  
  3238.  
  3239.  
  3240.      ■  Example
  3241.  
  3242.      gotoxy(0, 0);      // go to the top left corner
  3243.  
  3244.      gotoxy(79, 24);    // go to the bottom right corner
  3245.  
  3246.  
  3247.      HANGUP
  3248.      ──────────────────────────────────────────────────────────────────────
  3249.  
  3250.      ■  Summary
  3251.  
  3252.      hangup();
  3253.  
  3254.      ■  Description
  3255.  
  3256.      The hangup function tries to hang-up the modem, exactly as if the user
  3257.      had pressed Alt-H while in terminal mode. This is accomplished by
  3258.      first dropping (turning off) a signal called the DTR line, and if that
  3259.      is unsuccessful, sending the hang-up string defined in the configu-
  3260.      ration menu.
  3261.  
  3262.      ■  Return Value
  3263.  
  3264.      A non-zero (TRUE) value is returned if the hang-up is  successful,
  3265.      otherwise a zero (FALSE) value is returned.
  3266.  
  3267.  
  3268.      HELPSCREEN
  3269.      ──────────────────────────────────────────────────────────────────────
  3270.  
  3271.      ■  Summary
  3272.  
  3273.      helpscreen();
  3274.  
  3275.      ■  Description
  3276.  
  3277.      The helpscreen function displays the help/status screen, as if the
  3278.      user had pressed the appropriate key while in terminal mode.
  3279.  
  3280.      ■  Return Value
  3281.  
  3282.      None.
  3283.  
  3284.  
  3285.      INKEY, INKEYW
  3286.      ──────────────────────────────────────────────────────────────────────
  3287.  
  3288.      ■  Summary
  3289.  
  3290.      inkey();
  3291.  
  3292.      inkeyw();
  3293.      Telix v3.5x - SALT Programming                Built-in Functions    57
  3294.  
  3295.  
  3296.  
  3297.      ■  Description
  3298.  
  3299.      The inkey function returns a character from the keyboard, but does not
  3300.      wait for a key to be pressed.
  3301.  
  3302.      The inkeyw function returns a character from the keyboard, and waits
  3303.      for a key to be pressed if the keyboard buffer is empty.
  3304.  
  3305.      Note that Telix while executing a script file checks the keyboard be-
  3306.      tween every command to see if the user wants to abort the script. For
  3307.      these commands to work, this keyboard checking must be disabled. This
  3308.      is done by setting the _scr_chk_key system variable to a non-zero
  3309.      (FALSE) value (that variable is further described in the section on
  3310.      system variables).
  3311.  
  3312.      ■  Return Value
  3313.  
  3314.      inkey returns the first character in the keyboard buffer, or a value
  3315.      of 0 if the keyboard buffer is empty.
  3316.  
  3317.      inkeyw waits until a key has been pressed if none is available in the
  3318.      keyboard buffer, and returns that value.
  3319.  
  3320.      Both of these functions also return extended key code values which are
  3321.      not part of the ASCII character set (for example, the code for Alt-D).
  3322.      These values are described in the Appendix.
  3323.  
  3324.      ■  Example
  3325.  
  3326.      chr = inkey();
  3327.  
  3328.  
  3329.      INSCHRS
  3330.      ──────────────────────────────────────────────────────────────────────
  3331.  
  3332.      ■  Summary
  3333.  
  3334.      inschrs(str <source>, str <target>, int <pos>, int <num>);
  3335.  
  3336.      ■  Description
  3337.  
  3338.      The inschrs function is used to insert characters from one string into
  3339.      another at a specific position, shifting existing characters to the
  3340.      right. Characters are taken from <source> and placed in <target>, at
  3341.      an offset indicated by <pos>. Note that string offsets are numbered
  3342.      starting at 0, so the first character would have an offset of 0, the
  3343.      second 1, etc. Only <num> characters are inserted, and existing char-
  3344.      acters are shifted to the right (and are lost if they shift past the
  3345.      space allocated for the string).
  3346.  
  3347.      ■  Return Value
  3348.  
  3349.      None.
  3350.  
  3351.      ■  See Also
  3352.  
  3353.      copystr, copychrs
  3354.      Telix v3.5x - SALT Programming                Built-in Functions    58
  3355.  
  3356.  
  3357.  
  3358.      ■  Example
  3359.  
  3360.      str test[24] = "Good-bye";
  3361.      // add "Hello" to the front of the existing string
  3362.      inschrs("Hello ", test, 0, 6);
  3363.  
  3364.  
  3365.      ISALNUM - ISUPPER
  3366.      ──────────────────────────────────────────────────────────────────────
  3367.  
  3368.      ■  Summary
  3369.  
  3370.      isalnum(int <c>);   Test for alphanumeric ('A'-'Z', 'a'-'z', or '0'-
  3371.                               '9'
  3372.  
  3373.      isalpha(int <c>);   Test for letter ('A'-'Z' or 'a'-'z')
  3374.  
  3375.      isascii(int <c>);   Test for ASCII value (0-255)
  3376.  
  3377.      iscntrl(int <c>);   Test for Control character (0-31 or 127)
  3378.  
  3379.      isdigit(int <c>);   Test for digit ('0'-'9')
  3380.  
  3381.      islower(int <c>);   Test for lower case ('a'-'z')
  3382.  
  3383.      isupper(int <c>);   Test for upper case ('A'-'Z')
  3384.  
  3385.      ■  Description
  3386.  
  3387.      The functions listed above test an integer value and return a non-zero
  3388.      (TRUE) value if the test condition is satisfied, or a zero (FALSE) if
  3389.      it is not.
  3390.  
  3391.      Except for isascii, these functions give valid results only for in-
  3392.      teger values in the ASCII character set, that is, values for which
  3393.      isascii is true.
  3394.  
  3395.      ■  Return Value
  3396.  
  3397.      A non-zero (TRUE) value is returned if the test condition is sat-
  3398.      isfied, a 0 (FALSE) value otherwise.
  3399.  
  3400.  
  3401.      IS_LOADED
  3402.      ──────────────────────────────────────────────────────────────────────
  3403.  
  3404.      ■  Summary
  3405.  
  3406.      is_loaded(str <filename>);
  3407.  
  3408.      ■  Description
  3409.  
  3410.      The is_loaded function is used to determine if a SALT script, in-
  3411.      dicated by <filename> is currently loaded into memory. The script can
  3412.      be in memory if it was explicitly loaded with the load_script func-
  3413.      tion, or is still in memory because it previously was run and did not
  3414.      Telix v3.5x - SALT Programming                Built-in Functions    59
  3415.  
  3416.  
  3417.  
  3418.      finish executing. If filename does not include an extension, ".SLC" is
  3419.      automatically added.
  3420.  
  3421.      ■  Return Value
  3422.  
  3423.      A non-zero (TRUE) values is returned if the indicated script file is
  3424.      in memory, otherwise a zero (FALSE) value is returned.
  3425.  
  3426.      ■  See Also
  3427.  
  3428.      load_scr, unload_scr
  3429.  
  3430.      ■  Example
  3431.  
  3432.      if (!is_loaded("TESTSCR"))   // make sure script is in memory
  3433.       load_scr("TESTSCR");
  3434.  
  3435.  
  3436.      ITOS
  3437.      ──────────────────────────────────────────────────────────────────────
  3438.  
  3439.      ■  Summary
  3440.  
  3441.      itos(int <value>, str <s>);
  3442.  
  3443.      ■  Description
  3444.  
  3445.      The itos function writes out the digits of the supplied integer value
  3446.      to <s>.
  3447.  
  3448.      ■  Return Value
  3449.  
  3450.      None.
  3451.  
  3452.      ■  See Also
  3453.  
  3454.      stoi
  3455.  
  3456.      ■  Example
  3457.  
  3458.      int chr;
  3459.      str s[16];
  3460.      chr = inkeyw();       // get a user keystroke
  3461.      itos(chr, s);         // and print out ASCII value of character
  3462.      prints(s);
  3463.  
  3464.  
  3465.      KEYGET
  3466.      ──────────────────────────────────────────────────────────────────────
  3467.  
  3468.      ■  Summary
  3469.  
  3470.      keyget(int <key>, int <table>, str <buffer>);
  3471.      Telix v3.5x - SALT Programming                Built-in Functions    60
  3472.  
  3473.  
  3474.  
  3475.      ■  Description
  3476.  
  3477.      The keyget function is used to look at what text is assigned to a key.
  3478.      <key> is an integer value representing the key (as described in the
  3479.      appendix). Any macro text assigned to this key will be placed in
  3480.      <buffer>. Telix keeps two key macro definition tables in memory at all
  3481.      times, a user key table, and a terminal key table, loaded in whenever
  3482.      the current terminal is changed. If <table> is 0, the key is assumed
  3483.      to be in the user table. If <table> is 1, the key is assumed to be in
  3484.      the terminal table.
  3485.  
  3486.      ■  Return Value
  3487.  
  3488.      None.
  3489.  
  3490.      ■  See Also
  3491.  
  3492.      keyset, keyload, keysave
  3493.  
  3494.      ■  Example
  3495.  
  3496.      str s[100];
  3497.      prints("Text currently assigned to the F1 key in user table is:");
  3498.      keyget(0x3b00, 0, s);
  3499.      prints(s);
  3500.  
  3501.  
  3502.      KEYLOAD
  3503.      ──────────────────────────────────────────────────────────────────────
  3504.  
  3505.      ■  Summary
  3506.  
  3507.      keyload(str <fname>, int <table>);
  3508.  
  3509.      ■  Description
  3510.  
  3511.      The keyload function is used to load a keyboard macro definition file
  3512.      into Telix. <fname> is the name of the definition file (if no exten-
  3513.      sion is given, .KEY is assumed). Telix always keeps two definition ta-
  3514.      bles in memory, a relatively constant user table, and a terminal table
  3515.      which changes with each different terminal and holds the proper key
  3516.      assignments for that terminal. If <table> is 0, then the definitions
  3517.      are loaded into the user table. If <table> is 1, the definitions are
  3518.      loaded into the terminal table.
  3519.  
  3520.      ■  Return Value
  3521.  
  3522.      A value of -1 is returned if there are problems loading the key file,
  3523.      otherwise a non-zero (TRUE) value is returned.
  3524.  
  3525.      ■  See Also
  3526.  
  3527.      keysave, keyget, keyset
  3528.  
  3529.      ■  Example
  3530.  
  3531.      keyload("SPECIAL", 0);
  3532.      Telix v3.5x - SALT Programming                Built-in Functions    61
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.      KEYSAVE
  3539.      ──────────────────────────────────────────────────────────────────────
  3540.  
  3541.      ■  Summary
  3542.  
  3543.      keysave(str <fname>, int <table>);
  3544.  
  3545.      ■  Description
  3546.  
  3547.      The keysave function is used to save the current macro key text def-
  3548.      initions to a disk file. <fname> is the file to save the definitions
  3549.      to, and if no extension is given, ".KEY" is added. Telix always keeps
  3550.      two key definition tables in memory, a relatively constant user table,
  3551.      and a terminal table which changes with each different terminal and
  3552.      holds the proper key assignments for that terminal. If <table> is 0,
  3553.      then the definitions from the user table are saved. If <table> is 1,
  3554.      the definitions from the terminal table are saved.
  3555.  
  3556.      ■  Return Value
  3557.  
  3558.      A value of -1 is returned if there is a problem writing to the file,
  3559.      otherwise a non-zero (TRUE) value is returned.
  3560.  
  3561.      ■  See Also
  3562.  
  3563.      keyload, keyget, keyset
  3564.  
  3565.  
  3566.      KEYSET
  3567.      ──────────────────────────────────────────────────────────────────────
  3568.  
  3569.      ■  Summary
  3570.  
  3571.      keyset(int <key>, int <table>, str <text>);
  3572.  
  3573.      ■  Description
  3574.  
  3575.      The keyset function is used to assign text to a key. <key> is an in-
  3576.      teger value representing the key (as described in the appendix).
  3577.      <text> is what to assign to this key. Telix always keeps two key defi-
  3578.      nition tables in memory, a relatively constant user table, and a ter-
  3579.      minal table which changes with each different terminal and holds the
  3580.      proper key assignments for that terminal. If <table> is 0, the key
  3581.      definition in the user table is affected. If <table> is 1, the key
  3582.      definition in the terminal table is affected.
  3583.  
  3584.      ■  Return Value
  3585.  
  3586.      None.
  3587.  
  3588.      ■  See Also
  3589.  
  3590.      keyget, keyload, keysave
  3591.      Telix v3.5x - SALT Programming                Built-in Functions    62
  3592.  
  3593.  
  3594.  
  3595.      ■  Example
  3596.  
  3597.      // Assign a name to the F1 key in the user table
  3598.      // Note that if the terminal table also holds a
  3599.      // definition for that key it will take precedence
  3600.      keyset((0x3b00, 0, "Joe Smith");
  3601.  
  3602.  
  3603.      LOADFON
  3604.      ──────────────────────────────────────────────────────────────────────
  3605.  
  3606.      ■  Summary
  3607.  
  3608.      int loadfon(str <filename>);
  3609.  
  3610.      ■  Description
  3611.  
  3612.      The loadfon function loads the given dialing directory file. The com-
  3613.      plete name must be given, including any extension (e.g. .FON) or the
  3614.      disk drive/directory if the file is not in the current directory.
  3615.  
  3616.      ■  Return Value
  3617.  
  3618.      A non-zero (TRUE) value is returned if the dialing directory file is
  3619.      successfully loaded. If some sort of error occurs (file does not ex-
  3620.      ist, file reading error, etc.) a zero (FALSE) value is returned.
  3621.  
  3622.  
  3623.      LOAD_SCR
  3624.      ──────────────────────────────────────────────────────────────────────
  3625.  
  3626.      ■  Summary
  3627.  
  3628.      load_scr(str <filename>);
  3629.  
  3630.      ■  Description
  3631.  
  3632.      When a script is run (either by the user manually running it from ter-
  3633.      minal mode, or from within another script), it is usually loaded from
  3634.      disk. The load_scr function is used to load a script into memory ahead
  3635.      of time, providing a savings in time when the script must be run re-
  3636.      peatedly. <filename> is the name of the script file to load, and if no
  3637.      extension is given, ".SLC" is assumed.
  3638.  
  3639.      ■  Return Value
  3640.  
  3641.      If there is a problem loading the script file (it is not there or
  3642.      there is not enough memory),a value of -1 is returned. Otherwise a
  3643.      non-zero (TRUE) value is returned.
  3644.  
  3645.      ■  See Also
  3646.  
  3647.      unload_scr, is_loaded
  3648.  
  3649.      ■  Example
  3650.  
  3651.      int stat;
  3652.      Telix v3.5x - SALT Programming                Built-in Functions    63
  3653.  
  3654.  
  3655.  
  3656.      stat = load_scr("TEST");     // load TEST.SLC
  3657.  
  3658.  
  3659.      NEWDIR
  3660.      ──────────────────────────────────────────────────────────────────────
  3661.  
  3662.      ■  Summary
  3663.  
  3664.      newdir(str <directory>);
  3665.  
  3666.      ■  Description
  3667.  
  3668.      The newdir function is used to change the current drive and/or di-
  3669.      rectory. The <directory> argument should be the drive and/or directory
  3670.      to change to.
  3671.  
  3672.      ■  Return Value
  3673.  
  3674.      A non-zero (TRUE) value is returned if the function is successful,
  3675.      otherwise a zero (FALSE) values is returned (if the drive or directory
  3676.      is illegal or doesn't exist).
  3677.  
  3678.      ■  See Also
  3679.  
  3680.      dos, run
  3681.  
  3682.      ■  Example
  3683.  
  3684.      newdir("C:\TELIX");
  3685.  
  3686.  
  3687.      PRINTC
  3688.      ──────────────────────────────────────────────────────────────────────
  3689.  
  3690.      ■  Summary
  3691.  
  3692.      printc(int <chr>);
  3693.  
  3694.      ■  Description
  3695.  
  3696.      The printc function prints the character represented by the ASCII
  3697.      value <chr> to the terminal screen.
  3698.  
  3699.      ■  Return Value
  3700.  
  3701.      <chr> is returned.
  3702.  
  3703.      ■  See Also
  3704.  
  3705.      prints, printsc, printn
  3706.  
  3707.      ■  Example
  3708.  
  3709.      printc('A');
  3710.  
  3711.      printc(7);            // print ASCII value 7 (BELL sound)
  3712.      Telix v3.5x - SALT Programming                Built-in Functions    64
  3713.  
  3714.  
  3715.  
  3716.      printc(keyinw());     // print user keypress
  3717.  
  3718.  
  3719.      PRINTER
  3720.      ──────────────────────────────────────────────────────────────────────
  3721.  
  3722.      ■  Summary
  3723.  
  3724.      printer(int <state>);
  3725.  
  3726.      ■  Description
  3727.  
  3728.      The printer function is used within a script file to turn the printer
  3729.      on or off, as if the user had pressed the appropriate key in terminal
  3730.      mode. If <state> is a non-zero (TRUE) value, echoing to the printer is
  3731.      turned on, otherwise echoing is turned off
  3732.  
  3733.      ■  Return Value
  3734.  
  3735.      None.
  3736.  
  3737.      ■  See Also
  3738.  
  3739.      capture
  3740.  
  3741.      ■  Example
  3742.  
  3743.      printer(1);         // turn on printer log
  3744.  
  3745.  
  3746.      PRINTN
  3747.      ──────────────────────────────────────────────────────────────────────
  3748.  
  3749.      ■  Summary
  3750.  
  3751.      printn(int <num>);
  3752.  
  3753.      ■  Description
  3754.  
  3755.      The printn function prints the passed integer number to the terminal
  3756.      screen. The cursor is NOT advanced to the beginning of the next line.
  3757.  
  3758.      ■  Return Value
  3759.  
  3760.      The value of the passed integer is returned.
  3761.  
  3762.      ■  See Also
  3763.  
  3764.      prints, printsc, printc
  3765.  
  3766.      ■  Example
  3767.  
  3768.      printsc("Current baud rate is ");
  3769.      printn(get_baud);
  3770.      Telix v3.5x - SALT Programming                Built-in Functions    65
  3771.  
  3772.  
  3773.  
  3774.      PRINTS, PRINTSC, PRINTSC_TRM
  3775.      ──────────────────────────────────────────────────────────────────────
  3776.  
  3777.      ■  Summary
  3778.  
  3779.      prints(str <outstr>);
  3780.  
  3781.      printsc(str <outstr>);
  3782.  
  3783.      printsc_trm(str <outstr>);
  3784.  
  3785.      ■  Description
  3786.  
  3787.      The prints function prints the passed string at the current cursor po-
  3788.      sition on the screen, followed by a Carriage Return and Line Feed
  3789.      (which places the cursor at the beginning of the next line).
  3790.  
  3791.      The printsc function prints the passed string at the current cursor
  3792.      position on the screen. The cursor is not advanced to the next line,
  3793.      hence the 'c', which stands for continuous.
  3794.  
  3795.      The printsc_trm function is similar to the above, except that out-
  3796.      putted characters pass through the current terminal emulator, so ter-
  3797.      minal escape sequences may be included in output strings.
  3798.  
  3799.      ■  Return Value
  3800.  
  3801.      None.
  3802.  
  3803.      ■  See Also
  3804.  
  3805.      printn, printc
  3806.  
  3807.      ■  Example
  3808.  
  3809.      prints("Hello");
  3810.  
  3811.      printsc("Hello^M^J");    // same effect as above
  3812.  
  3813.      printsc_trm("^[[H");     // go to top left corner in VT102 emulation
  3814.  
  3815.  
  3816.      PSTRA, PSTRAXY
  3817.      ──────────────────────────────────────────────────────────────────────
  3818.  
  3819.      ■  Summary
  3820.  
  3821.      pstra(str <s>, int <color>);
  3822.  
  3823.      pstraxy(str <s>, int <x>, int <y>, int <color>);
  3824.  
  3825.      ■  Description
  3826.  
  3827.      The pstra (Print STRing with color Attribute) function is used to
  3828.      print a string to the screen, similar to the prints/printsc functions.
  3829.      This function is much faster however, and should be used when speed is
  3830.      important. As well, it allows a color to be specified for the text.
  3831.      Telix v3.5x - SALT Programming                Built-in Functions    66
  3832.  
  3833.  
  3834.  
  3835.      <s> will be printed to the screen at the current cursor position using
  3836.      a color as specified by <color>.
  3837.  
  3838.      The pstraxy function is similar to the above, but allows you to spec-
  3839.      ify where to print the string. The string is printed at <x>,<y>, with
  3840.      0,0 being the upper left corner of the screen.
  3841.  
  3842.      Note that prints goes through a basic TTY type terminal emulator, so
  3843.      strings printed using it may contain the basic cursor control code,
  3844.      while pstra writes directly to the screen, ignoring these sequences.
  3845.  
  3846.      ■  Return Value
  3847.  
  3848.      None.
  3849.  
  3850.      ■  See Also
  3851.  
  3852.      prints, printsc
  3853.  
  3854.      ■  Example
  3855.  
  3856.      pstraxy("Enter name:", 10, 10, 112);   // print in inverse text
  3857.  
  3858.  
  3859.      RECEIVE
  3860.      ──────────────────────────────────────────────────────────────────────
  3861.  
  3862.      ■  Summary
  3863.  
  3864.      receive(int <protocol>, str <name>);
  3865.  
  3866.      ■  Description
  3867.  
  3868.      The receive function is used to receive (download) one or more files
  3869.      from another system. <protocol> is the letter used to select the ap-
  3870.      propriate protocol from the actual download menu in Telix (e.g., 'X'
  3871.      for Xmodem), as follows:
  3872.  
  3873.                'A'       ASCII
  3874.                'K'       Kermit
  3875.                'M'       Modem7
  3876.                'S'       SEAlink
  3877.                'T'       Telink
  3878.                'X'       Xmodem
  3879.                '1'       Xmodem-1k
  3880.                'G'       Xmodem-1k-g
  3881.                'Y'       Ymodem
  3882.                'E'       YmodEm-g
  3883.                'Z'       Zmodem
  3884.  
  3885.      If an external protocol is defined, <protocol> may also be the key
  3886.      used to select it. <name> is the name the file should take. For pro-
  3887.      tocols which pass the name, such as SEAlink, Zmodem, Ymodem (batch),
  3888.      and others, the name field should be an empty string, "". If a down-
  3889.      load directory has been defined in the Configuration Menu, received
  3890.      files will go there, unless the <name> string explicitly includes a
  3891.      path to another drive/directory.
  3892.      Telix v3.5x - SALT Programming                Built-in Functions    67
  3893.  
  3894.  
  3895.  
  3896.      ■  Return Value
  3897.  
  3898.      A value of -1 is returned if the transfer was aborted, except if the
  3899.      Carrier (connection) was lost, in which case a value of -2 is re-
  3900.      turned.
  3901.  
  3902.      ■  See Also
  3903.  
  3904.      send, _down_dir
  3905.  
  3906.      ■  Example
  3907.  
  3908.      int result;
  3909.  
  3910.      result = receive('X', "TEST.EXE");
  3911.      if (result < 0)
  3912.       prints("File transfer failed!");
  3913.  
  3914.  
  3915.      REDIAL
  3916.      ──────────────────────────────────────────────────────────────────────
  3917.  
  3918.      ■  Summary
  3919.  
  3920.      redial(str <dialstr>, int <maxtries>, int <no_link>);
  3921.  
  3922.      ■  Description
  3923.  
  3924.      The redial function dials the entries specified in <dialstr>. The en-
  3925.      tries should be entered in the same format as used when typing entries
  3926.      in the dialing directory. If <dialstr> is empty (""), the redial queue
  3927.      is presented to the user, as if Alt-Q was pressed while in terminal
  3928.      mode. <maxtries> is the maximum number of dialing attempts. For exam-
  3929.      ple, if the string contains one entry, and <maxtries> is equal to 5,
  3930.      Telix will attempt to dial the number 5 times. If five entries are in-
  3931.      dicated, and <maxtries> is equal to 5, each number will only be at-
  3932.      tempted once. If <maxtries> is 0, dialing will continue until a con-
  3933.      nection is established. If an entry is connected to, and has a linked
  3934.      script file attached, that script will be run, unless <no_link> is
  3935.      non-zero (TRUE).
  3936.  
  3937.      ■  Return Value
  3938.  
  3939.      If there was a connection, the redial function returns the entry num-
  3940.      ber of the of the entry which was connected to (or 1 if a manual num-
  3941.      ber was dialed). If there was no connection established, 0 is re-
  3942.      turned. If the <dialstr> has a bad format, -1 is returned.
  3943.  
  3944.      Also, when a connection is successfully established, the entry number
  3945.      of the entry connected to is placed in the system variable
  3946.      _entry_enum, while the name of the entry connected to is placed in the
  3947.      system variable _entry_name.
  3948.  
  3949.      ■  See Also
  3950.  
  3951.      dial
  3952.      _entry_enum, _entry_name
  3953.      Telix v3.5x - SALT Programming                Built-in Functions    68
  3954.  
  3955.  
  3956.  
  3957.      ■  Example
  3958.  
  3959.      int stat;
  3960.      str number_list[] = "1 4 27";
  3961.      redial("10 15", 0);
  3962.      redial("m967-1111", 5);
  3963.      stat = redial(number_list, 0);
  3964.  
  3965.  
  3966.      RUN
  3967.      ──────────────────────────────────────────────────────────────────────
  3968.  
  3969.      ■  Summary
  3970.  
  3971.      run(str <filename>, str <comline>, int <mode>);
  3972.  
  3973.      ■  Description
  3974.  
  3975.      The run function executes the indicated file. The indicated file must
  3976.      either be in the current directory, be on the DOS PATH, or must in-
  3977.      clude the full path to the file (i.e., specify the drive and/or direc-
  3978.      tory). Make sure that if you run a program that expects user input you
  3979.      are on hand to give it. The <comline> parameter is the command line
  3980.      which should be passed to the called program. The <mode> argument
  3981.      specifies several options, as follows:
  3982.  
  3983.           0    Original screen is restored when program is completed.
  3984.           1    When program is completed, the user is prompted to press a
  3985.                key and screen is restored as soon as it is pressed.
  3986.           2    Original screen is not restored when program is completed
  3987.  
  3988.      This function is similar to the dos function. Because it uses less
  3989.      memory and loads faster, it is preferable to that function unless a
  3990.      DOS Batch file has to be run, or an internal DOS command must be spec-
  3991.      ified, in which case the dos function has to be used.
  3992.  
  3993.      ■  Return Value
  3994.  
  3995.      The run function returns a -1 if the file can not be run (because it
  3996.      can not be found or there is not enough memory). Any other value is
  3997.      the value returned by the called program (usually 0), but a positive
  3998.      value may also result when the called program is aborted.
  3999.  
  4000.      ■  See Also
  4001.  
  4002.      dos, dosfunction
  4003.  
  4004.      ■  Example
  4005.  
  4006.      run("CS", "test", 1);
  4007.      Telix v3.5x - SALT Programming                Built-in Functions    69
  4008.  
  4009.  
  4010.  
  4011.      SCROLL
  4012.      ──────────────────────────────────────────────────────────────────────
  4013.  
  4014.      ■  Summary
  4015.  
  4016.      scroll(int <x>, int <y>, int <x2>, int <y2>, int <lines>, int
  4017.      <color>);
  4018.  
  4019.      ■  Description
  4020.  
  4021.      The scroll function is used to scroll or clear a region of the screen.
  4022.      The area to handle is defined by <x>,<y> as the upper left corner, and
  4023.      <x2>,<y2> as the lower right corner (the upper left corner of the
  4024.      screen is 0,0). If the <lines> parameter is a positive value, text
  4025.      within the region is scrolled up that many lines. If <lines> is a neg-
  4026.      ative value, text within the region is scrolled down that many lines.
  4027.      If <lines> is equal to 0, the entire region is cleared. Empty lines
  4028.      scrolled into the region will have a color of <color>.
  4029.  
  4030.      ■  Return Value
  4031.  
  4032.      None.
  4033.  
  4034.      ■  See Also
  4035.  
  4036.      box
  4037.  
  4038.      ■  Example
  4039.  
  4040.      scroll(0, 0, 79, 24, 10, 7);      // scroll screen up 10 lines
  4041.  
  4042.  
  4043.      SEND
  4044.      ──────────────────────────────────────────────────────────────────────
  4045.  
  4046.      ■  Summary
  4047.  
  4048.      send(int <protocol>, str <name>);
  4049.  
  4050.      ■  Description
  4051.  
  4052.      The send function is used to send (upload) one or more files to an-
  4053.      other system over the comm port. <protocol> is the letter used to se-
  4054.      lect the appropriate protocol from the actual download menu in Telix
  4055.      (e.g., 'X' for Xmodem) as follows:
  4056.      Telix v3.5x - SALT Programming                Built-in Functions    70
  4057.  
  4058.  
  4059.  
  4060.                'A'       ASCII
  4061.                'K'       Kermit
  4062.                'M'       Modem7
  4063.                'S'       SEAlink
  4064.                'T'       Telink
  4065.                'X'       Xmodem
  4066.                '1'       Xmodem-1k
  4067.                'G'       Xmodem-1k-g
  4068.                'Y'       Ymodem
  4069.                'E'       YmodEm-g
  4070.                'Z'       Zmodem
  4071.  
  4072.      If an external protocol is defined, <protocol> may also be the key
  4073.      used to select. <name> is the file(s) to send. <name> may include the
  4074.      DOS wildcard characters * and ?, in which case all matching files will
  4075.      be sent (however the protocol used must be capable of sending more
  4076.      than one file at a time, e.g., SEAlink, Zmodem, Ymodem (batch), etc.).
  4077.      If an upload directory has been defined in the Configuration Menu,
  4078.      Telix will look there for files specified to be sent, unless the
  4079.      <name> string explicitly includes a path to another drive/directory.
  4080.  
  4081.      ■  Return Value
  4082.  
  4083.      A value of -1 is returned if the transfer was aborted, except if the
  4084.      carrier (connection) was lost, in which case a value of -2 is re-
  4085.      turned.
  4086.  
  4087.      ■  See Also
  4088.  
  4089.      receive, _up_dir
  4090.  
  4091.  
  4092.      SEND_BRK
  4093.      ──────────────────────────────────────────────────────────────────────
  4094.  
  4095.      ■  Summary
  4096.  
  4097.      send_brk(int <duration>);
  4098.  
  4099.      ■  Description
  4100.  
  4101.      The send_brk function sends a sustained break signal over the modem
  4102.      port, for a period of time, specified in tenths of a second, by
  4103.      <duration>.
  4104.  
  4105.      ■  Return Value
  4106.  
  4107.      None.
  4108.  
  4109.  
  4110.      SET_CPARAMS
  4111.      ──────────────────────────────────────────────────────────────────────
  4112.  
  4113.      ■  Summary
  4114.  
  4115.      set_cparams(int <baud>, int <parity>, int <data>, int <stop>);
  4116.      Telix v3.5x - SALT Programming                Built-in Functions    71
  4117.  
  4118.  
  4119.  
  4120.      ■  Description
  4121.  
  4122.      The set_cparams function is used to set the communications parameters
  4123.      in use on the current communications port. Allowable <baud> values are
  4124.      300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200. <parity>
  4125.      is an integer number which stands for the parity to use. Allowable
  4126.      values are 0, 1, and 2, which stand for None, Even, and Odd parity,
  4127.      respectively. <data> is the data bits setting to use; allowable values
  4128.      are 7 or 8. <stop> is the stop bits setting to use; allowable values
  4129.      are 1 or 2. Note that some combinations of settings are illegal.
  4130.  
  4131.      ■  Return Value
  4132.  
  4133.      If all the settings are legal values, a non-zero (TRUE) value is re-
  4134.      turned, otherwise a value of -1 is returned.
  4135.  
  4136.      ■  See Also
  4137.  
  4138.      set_port
  4139.  
  4140.      ■  Example
  4141.  
  4142.      set_cparams(2400, 0, 8, 1);
  4143.  
  4144.      set_cparams(9600, get_parity(), get_datab(), get_stopb());
  4145.  
  4146.      SET_DEFPROT
  4147.      ──────────────────────────────────────────────────────────────────────
  4148.  
  4149.      ■  Summary
  4150.  
  4151.      set_defprot(int <protocol>);
  4152.  
  4153.      ■  Description
  4154.  
  4155.      The set_defprot function is used to set the default file transfer pro-
  4156.      tocol presented to the user when a file transfer is requested.
  4157.      <protocol> is the letter used to select the appropriate protocol at
  4158.      the file transfer menu (see the description of the receive function
  4159.      for possible options).
  4160.  
  4161.      ■  Return Value
  4162.  
  4163.      None.
  4164.  
  4165.      ■  See Also
  4166.  
  4167.      receive, send
  4168.  
  4169.      ■  Example
  4170.  
  4171.      set_defprot('Z');      // Select Zmodem as default protocol
  4172.      Telix v3.5x - SALT Programming                Built-in Functions    72
  4173.  
  4174.  
  4175.  
  4176.      SETCHR
  4177.      ──────────────────────────────────────────────────────────────────────
  4178.  
  4179.      ■  Summary
  4180.  
  4181.      setchr(str <buf>, int <pos>, int <c>);
  4182.  
  4183.      ■  Description
  4184.  
  4185.      The setchr function puts the character <c> at position <pos> in the
  4186.      string indicated by <buf>.
  4187.  
  4188.      ■  Return Value
  4189.  
  4190.      The character <c> is returned.
  4191.  
  4192.      ■  See Also
  4193.  
  4194.      setchrs, subchr
  4195.  
  4196.      ■  Example
  4197.  
  4198.      int i;
  4199.      str s[100];
  4200.      for (i = 0; i < 10; ++i)     // set first 10 characters to 'A'
  4201.       setchr(s, i, 'A');
  4202.  
  4203.  
  4204.      SETCHRS
  4205.      ──────────────────────────────────────────────────────────────────────
  4206.  
  4207.      ■  Summary
  4208.  
  4209.      setchrs(str <buf>, int <pos>, int <c>, int <count>);
  4210.  
  4211.      ■  Description
  4212.  
  4213.      The setchrs function is used to set a range of characters in a string
  4214.      to the same value. <buf> is the string in which characters will be
  4215.      set, starting at an offset indicated by <pos> (note that the first
  4216.      character in a SALT string has an offset of 0, the second, 1, and so
  4217.      on). <count> characters will be set to the value of <c>.
  4218.  
  4219.      ■  Return Value
  4220.  
  4221.      None.
  4222.  
  4223.      ■  See Also
  4224.  
  4225.      setchr, subchrs
  4226.  
  4227.      ■  Example
  4228.  
  4229.      str s[100];
  4230.      // zero out an entire string
  4231.      setchrs(s, 0, 0, strmaxlen(s));
  4232.      // set the first ten characters to 'A'
  4233.      Telix v3.5x - SALT Programming                Built-in Functions    73
  4234.  
  4235.  
  4236.  
  4237.      setchrs(s, 0, 'A', 10);
  4238.  
  4239.  
  4240.      SET_PORT
  4241.      ──────────────────────────────────────────────────────────────────────
  4242.  
  4243.      ■  Summary
  4244.  
  4245.      set_port(int <port>);
  4246.  
  4247.      ■  Description
  4248.  
  4249.      The set_port function is used to select a communications port to use.
  4250.      Allowable values for <port> are 1 through 8.
  4251.  
  4252.      ■  Return Value
  4253.  
  4254.      If the new port can be successfully initialized, a non-zero (TRUE)
  4255.      value is returned, otherwise a value of -1 is returned.
  4256.  
  4257.      ■  See Also
  4258.  
  4259.      set_cparams
  4260.  
  4261.  
  4262.      SET_TERMINAL
  4263.      ──────────────────────────────────────────────────────────────────────
  4264.  
  4265.      ■  Summary
  4266.  
  4267.      set_terminal(str <terminal_name>);
  4268.  
  4269.      ■  Description
  4270.  
  4271.      The set_terminal function is used to switch the current terminal being
  4272.      emulated. <terminal_name> is the name of the new terminal to use, as
  4273.      follows:
  4274.  
  4275.           "TTY"
  4276.           "ANSI-BBS"
  4277.           "ANSI"
  4278.           "VT102"
  4279.           "VT52"
  4280.           "AVATAR"
  4281.  
  4282.      ■  Return Value
  4283.  
  4284.      A value of -1 is returned if there is a problem switching to the in-
  4285.      dicated terminal emulator, otherwise a non-zero (TRUE) value is re-
  4286.      turned.
  4287.  
  4288.      ■  Example
  4289.  
  4290.      set_terminal("VT102");
  4291.      Telix v3.5x - SALT Programming                Built-in Functions    74
  4292.  
  4293.  
  4294.  
  4295.      SHOW_DIRECTORY
  4296.      ──────────────────────────────────────────────────────────────────────
  4297.  
  4298.      ■  Summary
  4299.  
  4300.      show_directory(str <filespec>, int <cecho>, int <carrier>);
  4301.  
  4302.      ■  Description
  4303.  
  4304.      The show_directory function displays a files directory listing to the
  4305.      screen and optionally echoes it to the comm port. The <filespec> is
  4306.      the file mask to use (e.g., "*.*"), and may also include a drive
  4307.      and/or directory, just like the DOS 'dir' command. If the <cecho>
  4308.      argument is non-zero (TRUE), the listing is also be echoed to the comm
  4309.      port. If the <carrier> argument is non-zero (TRUE) and the listing is
  4310.      being echoed to the comm port, the carrier signal is monitored in case
  4311.      the connection is lost (which aborts the display). The user is
  4312.      prompted to press a key after every screen full of data.
  4313.  
  4314.      ■  Return Value
  4315.  
  4316.      None.
  4317.  
  4318.      ■  See Also
  4319.  
  4320.      dos, dosfunction
  4321.  
  4322.      ■  Example
  4323.  
  4324.      show_directory("*.DOC", 0, 0);
  4325.  
  4326.  
  4327.      STATUS_WIND
  4328.      ──────────────────────────────────────────────────────────────────────
  4329.  
  4330.      ■  Summary
  4331.  
  4332.      status_wind(str <message>, int <duration>);
  4333.  
  4334.      ■  Description
  4335.  
  4336.      The status_wind function is used to display a status message,
  4337.      <message>, in a pop up window. <duration> is the time in tenths of
  4338.      seconds to display the window, after which it is removed, and the pre-
  4339.      vious contents of that screen area are restored.
  4340.  
  4341.      ■  Return Value
  4342.  
  4343.      None.
  4344.  
  4345.      ■  See Also
  4346.  
  4347.      box, pstra, pstraxy
  4348.  
  4349.      ■  Example
  4350.  
  4351.      status_wind("File not found!", 10);
  4352.      Telix v3.5x - SALT Programming                Built-in Functions    75
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.      STOI
  4359.      ──────────────────────────────────────────────────────────────────────
  4360.  
  4361.      ■  Summary
  4362.  
  4363.      stoi(str <s>);
  4364.  
  4365.      ■  Description
  4366.  
  4367.      The stoi function assumes that <s> is a string which contains an in-
  4368.      teger number, written out. It processes the string digit by digit and
  4369.      returns that value. For example, stoi("123") would return the integer
  4370.      value 123. Processing stops at the first non-digit character. If an
  4371.      empty or invalid string is parsed, a value of 0 is returned.
  4372.  
  4373.      ■  Return Value
  4374.  
  4375.      An integer value as described above.
  4376.  
  4377.      ■  See Also
  4378.  
  4379.      itos
  4380.  
  4381.      ■  Example
  4382.  
  4383.      str s[] = "123";
  4384.      if (stoi(s) == 123)
  4385.       prints("This will always be printed!");
  4386.  
  4387.  
  4388.      STRCAT
  4389.      ──────────────────────────────────────────────────────────────────────
  4390.  
  4391.      ■  Summary
  4392.  
  4393.      strcat(str <string1>, str <string2>);
  4394.  
  4395.      ■  Description
  4396.  
  4397.      The strcat function concatenates (adds or appends) one string to the
  4398.      other. <string2> is added to the end of <string1>. If <string1> is not
  4399.      large enough only as many characters as will fit are added.
  4400.  
  4401.      ■  Return Value
  4402.  
  4403.      None.
  4404.  
  4405.      ■  Example
  4406.  
  4407.      str s[80] = "hello";
  4408.      strcat(s, "good-bye");
  4409.      if (s == "hellogoodbye")
  4410.       prints("This will always be printed");
  4411.      Telix v3.5x - SALT Programming                Built-in Functions    76
  4412.  
  4413.  
  4414.  
  4415.      STRCHR
  4416.      ──────────────────────────────────────────────────────────────────────
  4417.  
  4418.      ■  Summary
  4419.  
  4420.      strchr(str <s>, int <pos>, int <c);
  4421.  
  4422.      ■  Description
  4423.  
  4424.      The strchr function is used to search for a character within a string.
  4425.      <s> is the string to search, and <pos> is the starting position of the
  4426.      search, and <c> is the character (ASCII value) to search for. If the
  4427.      character, its offset is returned, otherwise a value of -1 is re-
  4428.      turned. Note that the first character in a string has an offset of 0,
  4429.      not 1 as in some languages.
  4430.  
  4431.      ■  Return Value
  4432.  
  4433.      An integer value as described above.
  4434.  
  4435.      ■  Example
  4436.  
  4437.      // Count how many times a certain char occurs in a string
  4438.  
  4439.      int i, count = 0;
  4440.      str s[] = "abcabcabcabcabc";
  4441.  
  4442.      i = 0;
  4443.      do
  4444.       {
  4445.        i = strchr(s, i, 'a');
  4446.        if (i != -1)
  4447.         count = count + 1;
  4448.       }
  4449.      while (i != -1);
  4450.  
  4451.  
  4452.      STRCMPI
  4453.      ──────────────────────────────────────────────────────────────────────
  4454.  
  4455.      ■  Summary
  4456.  
  4457.      strcmpi(str <string1>, str <string2>);
  4458.  
  4459.      ■  Description
  4460.  
  4461.      The strcmpi function is used to compare two strings (in a similar man-
  4462.      ner to the ==, >, and < operators, but ignoring the case of the
  4463.      strings). The strings are compared character by character until a dif-
  4464.      ference is found or the end of either string is found, and an integer
  4465.      value is returned as follows:
  4466.      Telix v3.5x - SALT Programming                Built-in Functions    77
  4467.  
  4468.  
  4469.  
  4470.           0         <string1> is equal to <string2>
  4471.  
  4472.           < 0       <string1> is less than <string2>
  4473.  
  4474.           > 0       <string1> is greater than <string2>
  4475.  
  4476.      ■  Return Value
  4477.  
  4478.      An integer value as described above.
  4479.  
  4480.      ■  Example
  4481.  
  4482.      if (strcmpi("HeLLo", "hEllO");
  4483.       prints("This will always be printed");
  4484.  
  4485.  
  4486.      STRLEN
  4487.      ──────────────────────────────────────────────────────────────────────
  4488.  
  4489.      ■  Summary
  4490.  
  4491.      strlen(str <s>);
  4492.  
  4493.      ■  Description
  4494.  
  4495.      The strlen function returns the number of characters in the string
  4496.      <s>. Since strings are terminated with a 0 (NULL) character, this
  4497.      function really counts the number of characters before a 0 is en-
  4498.      countered.
  4499.  
  4500.      ■  Return Value
  4501.  
  4502.      An integer value representing the length of a string.
  4503.  
  4504.      ■  See Also
  4505.  
  4506.      strmaxlen
  4507.  
  4508.      ■  Example
  4509.  
  4510.      str teststr[] = "This is a test string";
  4511.      printsc("The length of 'teststr' is ");
  4512.      printn(strlen(teststr));
  4513.  
  4514.  
  4515.      STRLOWER
  4516.      ──────────────────────────────────────────────────────────────────────
  4517.  
  4518.      ■  Summary
  4519.  
  4520.      strlower(str <s>);
  4521.  
  4522.      ■  Description
  4523.  
  4524.      The strlower function processes the string <s> and changes each upper
  4525.      case character to lower case. Other characters are left unchanged.
  4526.      Telix v3.5x - SALT Programming                Built-in Functions    78
  4527.  
  4528.  
  4529.  
  4530.      ■  Return Value
  4531.  
  4532.      None.
  4533.  
  4534.      ■  See Also
  4535.  
  4536.      strupper
  4537.  
  4538.  
  4539.      STRMAXLEN
  4540.      ──────────────────────────────────────────────────────────────────────
  4541.  
  4542.      ■  Summary
  4543.  
  4544.      strmaxlen(str <s>);
  4545.  
  4546.      ■  Description
  4547.  
  4548.      The strmaxlen function returns the maximum number of characters that
  4549.      string <s> can hold. This is the same value as used when the string is
  4550.      defined elsewhere in the program (e.g. if the string was defined as
  4551.      'str hello[16];', a value of 16 would be returned). All strings are
  4552.      really one character larger than defined, as the last character is al-
  4553.      ways a terminating 0 (NULL). However, since this value can not be
  4554.      changed, it is not counted as part of the length of a string.
  4555.  
  4556.      ■  Return Value
  4557.  
  4558.      An integer value as described above.
  4559.  
  4560.      ■  See Also
  4561.  
  4562.      strlen
  4563.  
  4564.  
  4565.      STRPOS, STRPOSI
  4566.      ──────────────────────────────────────────────────────────────────────
  4567.  
  4568.      ■  Summary
  4569.  
  4570.      strpos(str <string1>, str <substr>, int <start>);
  4571.  
  4572.      strposi(str <string1>, str <substr>, int <start>);
  4573.  
  4574.      ■  Description
  4575.  
  4576.      The strpos function is used to search for one string within another.
  4577.      <string1> is scanned for <substr>, starting at the offset (position)
  4578.      indicated by <start>. If the sub-string is found, its offset is re-
  4579.      turned, otherwise a value of -1 is returned. Note that the first char-
  4580.      acter has an offset of 0, not 1 as in some languages.
  4581.  
  4582.      strposi is a case insensitive version of the above.
  4583.  
  4584.      ■  Return Value
  4585.  
  4586.      An integer value as described above.
  4587.      Telix v3.5x - SALT Programming                Built-in Functions    79
  4588.  
  4589.  
  4590.  
  4591.      ■  Example
  4592.  
  4593.      str teststr[] = "cat dog cat dog";
  4594.      int i = 0, num = 0;
  4595.  
  4596.      while (1)           // loop as long as needed
  4597.       {
  4598.        i = strpos(teststr, "cat", i);
  4599.        if (i == -1)
  4600.         break;
  4601.        i = i + 1;        // make sure we don't find the same one
  4602.        num = num + 1;    // increment count
  4603.       }
  4604.  
  4605.      prints("'cat' was found ");
  4606.      printn(num);
  4607.      prints(" times.");
  4608.  
  4609.  
  4610.      STRUPPER
  4611.      ──────────────────────────────────────────────────────────────────────
  4612.  
  4613.      ■  Summary
  4614.  
  4615.      strupper(str <s>);
  4616.  
  4617.      ■  Description
  4618.  
  4619.      The strupper function processes the string <s> and changes each lower
  4620.      case character to upper case. Other characters are left unchanged.
  4621.  
  4622.      ■  Return Value
  4623.  
  4624.      None.
  4625.  
  4626.      ■  See Also
  4627.  
  4628.      strlower
  4629.  
  4630.  
  4631.      SUBCHR
  4632.      ──────────────────────────────────────────────────────────────────────
  4633.  
  4634.      ■  Summary
  4635.  
  4636.      subchr(str <s>, int <pos>);
  4637.  
  4638.      ■  Description
  4639.  
  4640.      The subchr function returns the character found at position <pos> in
  4641.      string <s>. Note that an integer (representing the ASCII value of the
  4642.      character) is returned, not a string. <pos> may be anywhere within the
  4643.      string length as defined. Note that positions start from 0. The 1st
  4644.      character in a string is at position 0, the 40th at position 39, etc.
  4645.      A string defined with a length of 10 would have valid positions of 0
  4646.      to 9, with position 10 always returning the 0 value that terminates
  4647.      all strings.
  4648.      Telix v3.5x - SALT Programming                Built-in Functions    80
  4649.  
  4650.  
  4651.  
  4652.      ■  Return Value
  4653.  
  4654.      An integer value as described above.
  4655.  
  4656.      ■  See Also
  4657.  
  4658.      setchr, subchrs
  4659.  
  4660.      ■  Example
  4661.  
  4662.      // This will print out the contents of a test string, extracting
  4663.      // each character individually, and stopping when a 0 is reached
  4664.      // which marks the end of all proper strings
  4665.  
  4666.      int i;
  4667.      str s[] = "This is a test string";
  4668.      for (i = 0; subchr(s, i) != 0; ++i)
  4669.       printc(subchr(s, i));
  4670.  
  4671.  
  4672.      SUBCHRS
  4673.      ──────────────────────────────────────────────────────────────────────
  4674.  
  4675.      ■  Summary
  4676.  
  4677.      subchrs(str <source>, int <pos>, int <count>, str <target>);
  4678.  
  4679.      ■  Description
  4680.  
  4681.      The subchrs function copies a number of characters from one string
  4682.      into another, Characters from position <pos> in <source> are copied
  4683.      into string <target> (note that SALT string offsets start at 0, not 1
  4684.      as in some languages). <count> characters are copied. Only as many
  4685.      characters as will fit in <target> are copied.
  4686.  
  4687.      This function is very similar to substr, except that it is not string
  4688.      oriented, and does not stop copying characters when a 0 value is en-
  4689.      countered.
  4690.  
  4691.      ■  Return Value
  4692.  
  4693.      None.
  4694.  
  4695.      ■  See Also
  4696.  
  4697.      substr, subchr, copystr, copychrs
  4698.  
  4699.  
  4700.      SUBSTR
  4701.      ──────────────────────────────────────────────────────────────────────
  4702.  
  4703.      ■  Summary
  4704.  
  4705.      substr(str <source>, int <pos>, int <max>, str <target>);
  4706.      Telix v3.5x - SALT Programming                Built-in Functions    81
  4707.  
  4708.  
  4709.  
  4710.      ■  Description
  4711.  
  4712.      The substr function copies a portion of one string to another. Char-
  4713.      acters from position <pos> in string <source> are copied until into
  4714.      string <target> (note that SALT string offsets start at 0, not 1 as in
  4715.      some languages). Characters are copied until a 0 (NULL) value is en-
  4716.      countered (normally at the end of every string), or <max> characters
  4717.      are copied. A 0 (NULL) is always copied at the end of the target
  4718.      string. The 0 does not count as part of the <max>. Only as many char-
  4719.      acters as will fit in <target> are copied.
  4720.  
  4721.      ■  Return Value
  4722.  
  4723.      None.
  4724.  
  4725.      ■  See Also
  4726.  
  4727.      subchrs, copystr, copychrs
  4728.  
  4729.      ■  Example
  4730.  
  4731.      str s[] = "horse cat dog", s2[16];
  4732.      substr(s, 6, 3, s2);
  4733.      if (s2 == "cat")
  4734.       prints("This will always be printed");
  4735.  
  4736.  
  4737.      TDAY - TYEAR
  4738.      ──────────────────────────────────────────────────────────────────────
  4739.  
  4740.      ■  Summary
  4741.  
  4742.      tday(int <timeval>);
  4743.  
  4744.      thour(int <timeval>);
  4745.  
  4746.      tmin(int <timeval>);
  4747.  
  4748.      tmonth(int <timeval>);
  4749.  
  4750.      tsec(int <timeval>);
  4751.  
  4752.      tyear(int <timeval>);
  4753.  
  4754.      ■  Description
  4755.  
  4756.      These functions all extract time information from <timeval>, which is
  4757.      a date and/or time of day. If <timeval> represents a date, it is the
  4758.      number of seconds from Jan 1, 1970 to that date. If <timeval> repre-
  4759.      sents a time of day, it is the number of seconds from midnight to that
  4760.      time. If it is both, the two above values are simply added together.
  4761.      Among others, the curtime and filetime functions return time/date in-
  4762.      formation in this format.
  4763.  
  4764.      tday returns an integer value from 1 to 31 representing the day por-
  4765.      tion of the date stored in <timeval>.
  4766.      Telix v3.5x - SALT Programming                Built-in Functions    82
  4767.  
  4768.  
  4769.  
  4770.      thour returns an integer value from 0 to 23 representing the hour por-
  4771.      tion of the time stored in <timeval>.
  4772.  
  4773.      tmin returns an integer value from 0 to 59 representing the minutes
  4774.      portion of the time stored in <timeval>.
  4775.  
  4776.      tmonth returns an integer value from 1 to 12 representing the month
  4777.      portion of the date stored in <timeval>.
  4778.  
  4779.      tsec returns an integer value from 1 to 59 representing the seconds
  4780.      portion of the time stored in <timeval>.
  4781.  
  4782.      tyear returns an integer value from 1970 to 2019 representing the year
  4783.      portion of the date stored in <timeval>.
  4784.  
  4785.      ■  Return Value
  4786.  
  4787.      An integer value as described above.
  4788.  
  4789.      ■  See Also
  4790.  
  4791.      curtime, filetime
  4792.  
  4793.      ■  Example
  4794.  
  4795.      int t;
  4796.      t = curtime();
  4797.      printsc("This is month number ");
  4798.      printn(tmonth(t));
  4799.      printsc(" in the year ");
  4800.      printn(tyear(t));
  4801.      prints(".");
  4802.  
  4803.  
  4804.      TERMINAL
  4805.      ──────────────────────────────────────────────────────────────────────
  4806.  
  4807.      ■  Summary
  4808.  
  4809.      terminal();
  4810.  
  4811.      ■  Description
  4812.  
  4813.      The terminal function when called allows Telix to process characters
  4814.      coming in from the serial port and print them on the terminal screen,
  4815.      and process user keystrokes. If a function has nothing to do (for ex-
  4816.      ample while using the track function), it can call terminal to make
  4817.      sure characters and user keystrokes are processed. Note that if a user
  4818.      script wants to process every incoming character (e.g., with the cgetc
  4819.      function, the terminal function should never be called).
  4820.  
  4821.      ■  Return Value
  4822.  
  4823.      None.
  4824.      Telix v3.5x - SALT Programming                Built-in Functions    83
  4825.  
  4826.  
  4827.  
  4828.      ■  See Also
  4829.  
  4830.      track
  4831.  
  4832.      ■  Example
  4833.  
  4834.      // This will wait forever for either of two strings
  4835.      // to come in from the comm port, and then stop.
  4836.      int t1, t2, stat;
  4837.      t1 = track("hello", 0);
  4838.      t2 = track("good-bye", 0);
  4839.      while (1)           // loop forever
  4840.       {
  4841.        terminal();       // The call to terminal() lets any characters
  4842.                          // that come in be looked at by Telix's
  4843.                          // internal routines for a match with.
  4844.                          // Incoming chars are also printed on the
  4845.                          // terminal screen and user keystrokes are
  4846.                          // handled
  4847.        stat = track_hit(0);
  4848.        if (stat == t1 || stat == t2)   // exit if one of the strings
  4849.         break;                         // came in
  4850.       }
  4851.  
  4852.      track_free(t1);     // stop Telix for looking for more matches
  4853.      track_free(t2);
  4854.  
  4855.  
  4856.      TIME
  4857.      ──────────────────────────────────────────────────────────────────────
  4858.  
  4859.      ■  Summary
  4860.  
  4861.      time(int <timeval>, str <buffer>);
  4862.  
  4863.      ■  Description
  4864.  
  4865.      The time function writes out a time in <buffer> in the form hh:mm:ss,
  4866.      with hh being the hour in either 12 or 24 hour format based on the
  4867.      _time_format). <timeval> is the time, represented as the number of
  4868.      seconds since midnight. Time values in this form are returned by the
  4869.      curtime and filetime functions, among others.
  4870.  
  4871.      ■  Return Value
  4872.  
  4873.      None.
  4874.  
  4875.      ■  See Also
  4876.  
  4877.      date, curtime, filetime
  4878.  
  4879.      ■  Example
  4880.  
  4881.      str s[16];
  4882.      printsc("The current time is ");
  4883.      time(curtime(), s);
  4884.      prints(s);
  4885.      Telix v3.5x - SALT Programming                Built-in Functions    84
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.      TIME_UP - TIMER_TOTAL
  4892.      ──────────────────────────────────────────────────────────────────────
  4893.  
  4894.      ■  Summary
  4895.  
  4896.      time_up(int <thandle>);
  4897.  
  4898.      timer_free(int <thandle>);
  4899.  
  4900.      timer_restart(int <thandle>, int <time>);
  4901.  
  4902.      timer_start(int <time>);
  4903.  
  4904.      timer_total(int <thandle>);
  4905.  
  4906.      ■  Description
  4907.  
  4908.      The timer functions are used to set and keep track of a timer vari-
  4909.      able.
  4910.  
  4911.      The timer_start function is used to start a timer. This timer can
  4912.      later be used to check if a certain period of time has elapsed from
  4913.      when the timer was started. This function returns an integer value
  4914.      called a timer handle, that is used to refer to this timer in the fu-
  4915.      ture. The <time> parameter is the time from the present (in tenths of
  4916.      a second) after which the timer should be considered elapsed (for use
  4917.      with the time_up function). If the time_up function will not be used,
  4918.      then this parameter can be anything.
  4919.  
  4920.      The time_up function returns a non-zero (TRUE) value if the timer rep-
  4921.      resented by timer handle <thandle> has elapsed, otherwise a 0 (FALSE)
  4922.      value is returned. The period of time after which a timer will elapse
  4923.      is specified in the timer_start function.
  4924.  
  4925.      The timer_total function returns the total time (in tenths of a sec-
  4926.      ond) since the timer represented by timer handle <thandle> was started
  4927.      or restarted.
  4928.  
  4929.      The timer_restart function performs the same things as timer_start,
  4930.      except that it restarts an existing timer, represented by timer handle
  4931.      <thandle>.
  4932.  
  4933.      The timer_free function frees a timer variable when it is no longer
  4934.      needed. <thandle> is the timer handle of the timer to free, and should
  4935.      originally have been returned by the timer_start function. After a
  4936.      timer has been freed it should no longer be referred to.
  4937.  
  4938.      ■  Return Value
  4939.  
  4940.      timer_start returns an integer number representing a 'handle' by which
  4941.      a timer will be referred to.
  4942.  
  4943.      time_up returns a non-zero (TRUE) or 0 (FALSE) value depending on
  4944.      whether a timer has elapsed or not.
  4945.      Telix v3.5x - SALT Programming                Built-in Functions    85
  4946.  
  4947.  
  4948.  
  4949.      timer_total returns an integer value representing the elapsed time
  4950.      since a timer was started.
  4951.  
  4952.      timer_restart does not return any significant value.
  4953.  
  4954.      timer_free does not return any significant value.
  4955.  
  4956.      ■  See Also
  4957.  
  4958.      delay
  4959.  
  4960.      ■  Example
  4961.  
  4962.      int t;
  4963.      t = timer_start(100);    // delay for 10 seconds
  4964.      while (!time_up(t))
  4965.       ;
  4966.      timer_free(t);
  4967.      // start a timer and loop forever, printing the elapsed time
  4968.      // in tenths of seconds
  4969.      t = timer_start(0);
  4970.      while (1)
  4971.       {
  4972.        printn(timer_total(t));
  4973.        prints("");
  4974.       }
  4975.  
  4976.  
  4977.      TOLOWER
  4978.      ──────────────────────────────────────────────────────────────────────
  4979.  
  4980.      ■  Summary
  4981.  
  4982.      tolower(int <chr>);
  4983.  
  4984.      ■  Description
  4985.  
  4986.      If the character <chr> is an uppercase character, the tolower function
  4987.      returns the lowercase equivalent. Otherwise <chr> is returned un-
  4988.      changed. Note that <chr> is an ASCII value, not a string.
  4989.  
  4990.      ■  Return Value
  4991.  
  4992.      An integer value as described above.
  4993.  
  4994.      ■  See Also
  4995.  
  4996.      toupper
  4997.  
  4998.  
  4999.      TONE
  5000.      ──────────────────────────────────────────────────────────────────────
  5001.  
  5002.      ■  Summary
  5003.  
  5004.      tone(int <frequency>, int <length>);
  5005.      Telix v3.5x - SALT Programming                Built-in Functions    86
  5006.  
  5007.  
  5008.  
  5009.      ■  Description
  5010.  
  5011.      The tone function makes Telix emit a sound of <frequency> for a period
  5012.      of time represented by length (in hundredths of a second).
  5013.  
  5014.      ■  Return Value
  5015.  
  5016.      None.
  5017.  
  5018.      ■  See Also
  5019.  
  5020.      alarm
  5021.      _sound_on
  5022.  
  5023.      ■  Example
  5024.  
  5025.      tone(659, 14);
  5026.  
  5027.  
  5028.      TOUPPER
  5029.      ──────────────────────────────────────────────────────────────────────
  5030.  
  5031.      ■  Summary
  5032.  
  5033.      tolower(int <chr>);
  5034.  
  5035.      ■  Description
  5036.  
  5037.      If the character <chr> is an lowercase character, the toupper function
  5038.      returns the uppercase equivalent. Otherwise <chr> is returned un-
  5039.      changed. Note that <chr> is an ASCII value, not a string.
  5040.  
  5041.      ■  Return Value
  5042.  
  5043.      An integer value as described above.
  5044.  
  5045.      ■  See Also
  5046.  
  5047.      tolower
  5048.  
  5049.  
  5050.      TRACK - TRACK_HIT
  5051.      ──────────────────────────────────────────────────────────────────────
  5052.  
  5053.      ■  Summary
  5054.  
  5055.      track(str <trackstr>, int <mode>);
  5056.  
  5057.      track_addchr(int <chr>);
  5058.  
  5059.      track_free(int <handle>);
  5060.  
  5061.      track_hit(int <handle>);
  5062.      Telix v3.5x - SALT Programming                Built-in Functions    87
  5063.  
  5064.  
  5065.  
  5066.      ■  Description
  5067.  
  5068.      The track and related functions are used to keep track of and wait for
  5069.      certain strings to come in over the comm port, similar in nature to
  5070.      the waitfor function. However the latter function can only wait for
  5071.      one specific string, while with the track functions can handle more
  5072.      strings at the same time (currently up to 16), and they may arrive in
  5073.      any order (or not arrive at all).
  5074.  
  5075.      The track function tells Telix to keep track of (watch for) the string
  5076.      indicated by <trackstr> to come in over the comm port. If <mode> is 0,
  5077.      case is significant, if <mode> is 1, case is not significant. The for-
  5078.      mer is faster and should be used when the many strings are being
  5079.      watched for. Track returns an integer value called a 'track handle'
  5080.      which is later used with the track_hit function to check if this
  5081.      string came in.
  5082.  
  5083.      When track is called, Telix doesn't loop endlessly waiting for the
  5084.      string to come in, but instead returns back to the script. As char-
  5085.      acters come in, Telix checks to see if any of the strings to be
  5086.      tracked have been matched, and marks those that have. A script can at
  5087.      any time call the track_hit function to see if the string represented
  5088.      by <handle> was received. If track_hit returns a non-zero (TRUE)
  5089.      value, then that string was received, otherwise it wasn't. If <handle>
  5090.      is 0, then track_hit will return the lowest numbered handle of any
  5091.      strings that came in, or 0 if none did. The marker on a handle is
  5092.      cleared once track_hit has indicated that the appropriate string was
  5093.      received.
  5094.  
  5095.      While a script is executing, Telix is not in terminal mode, and there-
  5096.      fore does not have access to incoming characters, to scan for matching
  5097.      strings. Therefore, the terminal function must periodically be called
  5098.      to allow Telix to get a look at incoming characters. This function is
  5099.      described in the appropriate place in this manual. Alternately, if a
  5100.      script must process these characters itself (with a function like
  5101.      cgetc), and therefore can not call the terminal function, they must
  5102.      still be passed by the track routines for string matching to work. The
  5103.      track_addchr function is used for this. When it is called, Telix
  5104.      treats the character represented by <chr> as if it had been received
  5105.      from the terminal handler, and uses it to scan for matching strings.
  5106.  
  5107.      The track_free function is used to tell Telix to stop tracking a cer-
  5108.      tain string. <handle> is a track handle returned by a previous call to
  5109.      the track function. It is very important that when a certain string no
  5110.      longer needs to be tracked, track_free is called, as tracking a large
  5111.      number of strings can slow down Telix execution. If <handle> is 0,
  5112.      Telix will stop tracking all strings.
  5113.  
  5114.      ■  Return Value
  5115.  
  5116.      track_addchr and track_free do not return a value. The other functions
  5117.      return integer values as described above.
  5118.  
  5119.      ■  See Also
  5120.  
  5121.      waitfor
  5122.      Telix v3.5x - SALT Programming                Built-in Functions    88
  5123.  
  5124.  
  5125.  
  5126.      ■  Example
  5127.  
  5128.      // Log-on to a BBS, answering two prompts in any order.
  5129.      // This will wait forever, so for actual use would have
  5130.      // to be changed a bit. See sample scripts for examples.
  5131.  
  5132.      int stat, t1, t2;
  5133.      t1 = track("Name? ", 0);
  5134.      t2 = track("Password? ", 0);
  5135.  
  5136.      while (1)         // loop as long as needed
  5137.       {
  5138.        terminal();     // call terminal function to allow Telix
  5139.                        // to look at incoming characters for
  5140.                        // matches and let Telix process user
  5141.                        // keystrokes
  5142.        stat = track_hit(0);       // see if any matches
  5143.        if (stat == t1)            // name prompt
  5144.          cputs("Joe Smith^M");    // send name and continue looping
  5145.        if (stat == t2)            // password prompt
  5146.         {
  5147.          cputs("mypass^M");       // send password
  5148.          break;                   //   and get out of loop
  5149.         }
  5150.       }
  5151.  
  5152.      track_free(t1);              // free track handles
  5153.      track_free(t2);
  5154.  
  5155.  
  5156.      TRANSTAB
  5157.      ──────────────────────────────────────────────────────────────────────
  5158.  
  5159.      ■  Summary
  5160.  
  5161.      transtab(str <filename>, int <table>);
  5162.  
  5163.      ■  Description
  5164.  
  5165.      The transtab function is used to load or clear the incoming or out-
  5166.      going character translation table. <table> stands for the translate
  5167.      table to manipulate, with 0 being the incoming, and 1 being the out-
  5168.      going.
  5169.  
  5170.      If <filename> is empty (""), Telix will prompt for the name of a
  5171.      translate table to load into memory.
  5172.  
  5173.      If <filename> is a valid name for a Telix translate table (saved from
  5174.      the translate table menu in Telix), it is loaded into memory.
  5175.  
  5176.      If <filename> is "*CLEAR*", the current translate table in memory is
  5177.      cleared, and Telix will no longer translate incoming characters.
  5178.  
  5179.      ■  Return Value
  5180.  
  5181.      A value of -1 is returned if there is a problem loading the indicated
  5182.      translate table, otherwise a non-zero (TRUE) value is returned.
  5183.      Telix v3.5x - SALT Programming                Built-in Functions    89
  5184.  
  5185.  
  5186.  
  5187.      ■  Example
  5188.  
  5189.      transtab("TELIX.XLT", 0);
  5190.  
  5191.  
  5192.      UNLOAD_SCR
  5193.      ──────────────────────────────────────────────────────────────────────
  5194.  
  5195.      ■  Summary
  5196.  
  5197.      unload_scr(str <filename>);
  5198.  
  5199.      ■  Description
  5200.  
  5201.      The load_scr function can be used by a script file to load another
  5202.      script into memory ahead of time (before it is run). The unload_scr
  5203.      function should then be used to unload or take out this script when it
  5204.      is no longer needed. <filename> is the name of the script file to un-
  5205.      load, and if no extension is given, ".SLC" is assumed. Note that a
  5206.      script that is currently executing or that is nested (has called the
  5207.      current script) must not be unloaded, since Telix is still executing
  5208.      it or will return to it eventually!
  5209.  
  5210.      ■  Return Value
  5211.  
  5212.      If there is a problem unloading the script file, a value of -1 is re-
  5213.      turned. Otherwise a non-zero (TRUE) value is returned.
  5214.  
  5215.      ■  See Also
  5216.  
  5217.      load_scr, is_loaded
  5218.  
  5219.      ■  Example
  5220.  
  5221.      int stat;
  5222.      stat = load_scr("TEST");     // load TEST.SLC
  5223.          ...                      // do other things
  5224.      unload_scr("TEST");          // take TEST.SLC out of memory
  5225.  
  5226.  
  5227.      UPDATE_TERM;
  5228.      ──────────────────────────────────────────────────────────────────────
  5229.  
  5230.      ■  Summary
  5231.  
  5232.      update_term();
  5233.  
  5234.      ■  Description
  5235.  
  5236.      The update_term function is called to make sure Telix updates certain
  5237.      things relating to the video and terminal page. For example, changes
  5238.      made to the _back_color and _fore_color system variables will not take
  5239.      effect until this function is called. As well Telix may sometimes take
  5240.      up to 15 seconds to update the status bar (and in some cases while
  5241.      scripts are running, won't update it at all). Calling this function
  5242.      ensures that the status bar is updated.
  5243.      Telix v3.5x - SALT Programming                Built-in Functions    90
  5244.  
  5245.  
  5246.  
  5247.      ■  Return Value
  5248.  
  5249.      None.
  5250.  
  5251.      ■  Example
  5252.  
  5253.      int temp;               // reverse current terminal colors
  5254.      temp = back_color;
  5255.      back_color = fore_color;
  5256.      fore_color = temp;
  5257.      update_term();
  5258.  
  5259.  
  5260.      USAGELOG
  5261.      ──────────────────────────────────────────────────────────────────────
  5262.  
  5263.      ■  Summary
  5264.  
  5265.      usagelog(str <filename>);
  5266.  
  5267.      ■  Description
  5268.  
  5269.      The usagelog function is used to manipulate the Telix usage log fa-
  5270.      cility.
  5271.  
  5272.      If <filename> is an empty string (""), Telix will ask for the filename
  5273.      to open the usage log to, as if the user had pressed Alt-U in terminal
  5274.      mode.
  5275.  
  5276.      If <filename> contains a valid filename, the usage log is opened to
  5277.      that file. The standard usage log is usually called "TELIX.USE".
  5278.  
  5279.      If <filename> is "*CLOSE*", and the usage log is currently open, it is
  5280.      closed.
  5281.  
  5282.      ■  Return Value
  5283.  
  5284.      A value of -1 is returned if there is a problem performing the indi-
  5285.      cated operation, otherwise a non-zero (TRUE) value is returned.
  5286.  
  5287.      ■  See Also
  5288.  
  5289.      ustamp, usage_stat
  5290.      _usage_fname
  5291.  
  5292.      ■  Example
  5293.  
  5294.      usagelog("TELIX.USE");
  5295.  
  5296.  
  5297.      USAGE_STAT
  5298.      ──────────────────────────────────────────────────────────────────────
  5299.  
  5300.      ■  Summary
  5301.  
  5302.      usage_stat();
  5303.      Telix v3.5x - SALT Programming                Built-in Functions    91
  5304.  
  5305.  
  5306.  
  5307.      ■  Description
  5308.  
  5309.      The usage_stat function returns an integer value representing the cur-
  5310.      rent status of the Usage Log. If the Usage Log is currently open, a
  5311.      non-zero (TRUE) value is returned, otherwise a value of zero (FALSE)
  5312.      is returned.
  5313.  
  5314.      ■  Return Value
  5315.  
  5316.      An integer values as described above.
  5317.  
  5318.      ■  See Also
  5319.  
  5320.      usagelog, capture_stat
  5321.  
  5322.  
  5323.      USTAMP
  5324.      ──────────────────────────────────────────────────────────────────────
  5325.  
  5326.      ■  Summary
  5327.  
  5328.      ustamp(str <text>, int <new_entry>, int <add_nl>);
  5329.  
  5330.      ■  Description
  5331.  
  5332.      The ustamp function is used to place (stamp) text into the Telix usage
  5333.      log. If the usage log is currently not open, this function call is
  5334.      simply ignored. <text> is the entry that should be placed into the us-
  5335.      age log. If <new_entry> contains a non-zero (TRUE) value, the current
  5336.      date/time is placed ahead of the text, otherwise it is assumed that
  5337.      this is a continuation of a previous entry and no date/time is added.
  5338.      If <add_nl> (add new line) is a non-zero (TRUE) value, a Carriage Re-
  5339.      turn and Line Feed character are added after the entry. This is usu-
  5340.      ally the case unless something else must be added on the same line.
  5341.  
  5342.      ■  Return Value
  5343.  
  5344.      A value of -1 is returned if there is a problem writing to the usage
  5345.      log, otherwise a non-zero (TRUE) value is returned.
  5346.  
  5347.      ■  See Also
  5348.  
  5349.      usagelog
  5350.  
  5351.      ■  Example
  5352.  
  5353.      ustamp("Calling user subroutine... ", 1, 0);
  5354.      if (user_sub == -1)
  5355.       ustamp("Failed!, 0, 1);
  5356.      else
  5357.       ustamp("Successful", 0, 1);
  5358.      Telix v3.5x - SALT Programming                Built-in Functions    92
  5359.  
  5360.  
  5361.  
  5362.      VGETCHR
  5363.      ──────────────────────────────────────────────────────────────────────
  5364.  
  5365.      ■  Summary
  5366.  
  5367.      vgetchr();
  5368.  
  5369.      ■  Description
  5370.  
  5371.      The vgetchr function is used to read the character (including color
  5372.      information) at the current cursor position on the video screen. The
  5373.      return value contains the character in the first (low) byte, and the
  5374.      color of the character in the higher (second) byte. Each component may
  5375.      be extracted using the & and / operators as shown in the example be-
  5376.      low. Basically, if 'c' is the returned character/color value, the
  5377.      character alone may be obtained by using the expression
  5378.  
  5379.           (c & 255)
  5380.  
  5381.      while the color value is
  5382.  
  5383.           (c / 256)
  5384.  
  5385.      ■  Return Value
  5386.  
  5387.      An integer value as described above.
  5388.  
  5389.      ■  See Also
  5390.  
  5391.      vgetchrs, vgetchrsa, vputchr
  5392.  
  5393.      ■  Example
  5394.  
  5395.      int chr;
  5396.      chr = vgetchr();      // Get char/color at current cursor position
  5397.      printsc("The character was ");
  5398.      printc(chr & 255);    // get character by masking out color byte
  5399.      printsc(" with a color value of ");
  5400.      printn(chr / 256);     // shift color byte
  5401.  
  5402.  
  5403.      VGETCHRS, VGETCHRSA
  5404.      ──────────────────────────────────────────────────────────────────────
  5405.  
  5406.      ■  Summary
  5407.  
  5408.      vgetchrs(int <x>, int <y>, str <buf>, int <pos>, int <num>);
  5409.  
  5410.      vgetchrsa(int <x>, int <y>, str <buf>, int <pos>, int <num>);
  5411.  
  5412.      ■  Description
  5413.  
  5414.      The vgetchrs and vgetchrsa functions are used to read multiple char-
  5415.      acters starting from a spot on the screen into a specified variable.
  5416.      The first function saves only the characters (a sequence of bytes)
  5417.      while the second saves both the characters and color attributes (a se-
  5418.      ries of double bytes). <x>,<y> is the spot on the screen to start
  5419.      Telix v3.5x - SALT Programming                Built-in Functions    93
  5420.  
  5421.  
  5422.  
  5423.      reading characters. <buf> is the string variable to put characters
  5424.      into, starting at an offset of <pos> in the variable. Note that each
  5425.      character read in with vgetchrsa will take up two bytes in the string
  5426.      variable, since the color attribute is also saved. Note also that
  5427.      these functions do not put a 0 (NULL, or end of string character) at
  5428.      the end of the sequence of characters they grab. If the characters re-
  5429.      turned by vgetchrs are to be manipulated as a string a 0 must be added
  5430.      at the end with the setchr function.
  5431.  
  5432.      ■  Return Value
  5433.  
  5434.      None.
  5435.  
  5436.      ■  See Also
  5437.  
  5438.      vgetchr, vputchrs, vputchrsa
  5439.  
  5440.      ■  Example
  5441.  
  5442.      // copy 20 characters starting from 10,10 on the screen to 20,20
  5443.      // Don't keep color attributes
  5444.      str buffer[20];
  5445.      vgetchrs(10, 10, buffer, 0, 20);
  5446.      vputchrs(20, 20, buffer, 0, 20);
  5447.  
  5448.      // copy a 20 by 10 grid of characters with a left hand corner of
  5449.      // 10,5 to 40,7, and keep color attributes
  5450.      str buffer[400];   // 20 wide * 10 tall * 2 bytes per character
  5451.      int y;
  5452.      for (y = 5; y < 15; y = y+1)         // read chars in a loop
  5453.       vgetchrsa(10, y, buffer, 2 * 20 * (y - 5), 20);
  5454.      for (y = 7; y < 17; y = y+1)         // now write them in a loop
  5455.       vputchrs(10, y, buffer, 2 * 20 * (y - 7), 20);
  5456.  
  5457.  
  5458.      VPUTCHR
  5459.      ──────────────────────────────────────────────────────────────────────
  5460.  
  5461.      ■  Summary
  5462.  
  5463.      vputchr(int <chr>);
  5464.  
  5465.      ■  Description
  5466.  
  5467.      The vputchr function is used to place a character on the screen at the
  5468.      current cursor position, specifying color information at the same
  5469.      time. <chr> is the character to place on the screen. the low byte con-
  5470.      tains the ASCII value of the character, while the second byte contains
  5471.      the color value. In general, a if 'c' is the character, and 'color' is
  5472.      the color to use, the proper value is obtained with the expression
  5473.  
  5474.           (c + color * 256)
  5475.  
  5476.      ■  Return Value
  5477.  
  5478.      None.
  5479.      Telix v3.5x - SALT Programming                Built-in Functions    96
  5480.  
  5481.  
  5482.  
  5483.      ■  See Also
  5484.  
  5485.      vgetchr
  5486.  
  5487.      ■  Example
  5488.  
  5489.      // Place an inverse 'X' in the left top corner of the screen
  5490.      gotoxy(0, 0);
  5491.      vputchr('X' + 112 * 256);
  5492.  
  5493.  
  5494.      VPUTCHRS, VPUTCHRSA
  5495.      ──────────────────────────────────────────────────────────────────────
  5496.  
  5497.      ■  Summary
  5498.  
  5499.      vputchrs(int <x>, int <y>, str <buf>, int <pos>, int <num>, int
  5500.      <attr>);
  5501.  
  5502.      vputchrsa(int <x>, int <y>, str <buf>, int <pos>, int <num>);
  5503.  
  5504.      ■  Description
  5505.  
  5506.      The vputchrs and vputchrsa functions are used to write multiple char-
  5507.      acters from a spot in a string variable onto the screen at a certain
  5508.      position. The first function assumes that the string contains charac-
  5509.      ters only, and writes them to the screen using a color attribute of
  5510.      <attr>, as described in Appendix C. The second function assumes that
  5511.      each character in the string is immediately followed by a color value
  5512.      (a series of double bytes). <x>,<y> is the spot on the screen to start
  5513.      writing characters. <buf> is the string variable to read characters
  5514.      from, starting at an offset of <pos> in the variable. Note that each
  5515.      character written with vputchrsa will take up two bytes in the string
  5516.      variable, since the color attribute is also there, so the offset
  5517.      should reflect this.
  5518.  
  5519.      ■  Return Value
  5520.  
  5521.      None.
  5522.  
  5523.      ■  See Also
  5524.  
  5525.      vputchr, vgetchrs, vgetchrsa
  5526.  
  5527.      ■  Example
  5528.  
  5529.      // copy 20 characters starting from 10,10 on the screen to 20,20
  5530.      // Don't keep color attributes
  5531.      str buffer[20];
  5532.      vgetchrs(10, 10, buffer, 0, 20);
  5533.      vputchrs(20, 20, buffer, 0, 20);
  5534.  
  5535.      // copy a 20 by 10 grid of characters with a left hand corner of
  5536.      // 10,5 to 40,7, and keep color attributes
  5537.      str buffer[400];   // 20 wide * 10 tall * 2 bytes per character
  5538.      int y;
  5539.      for (y = 5; y < 15; y = y+1)         // read chars in a loop
  5540.      Telix v3.5x - SALT Programming                Built-in Functions    95
  5541.  
  5542.  
  5543.  
  5544.       vgetchrsa(10, y, buffer, 2 * 20 * (y - 5), 20);
  5545.      for (y = 7; y < 17; y = y+1)         // now write them in a loop
  5546.       vputchrs(10, y, buffer, 2 * 20 * (y - 7), 20);
  5547.  
  5548.  
  5549.      VRSTRAREA
  5550.      ──────────────────────────────────────────────────────────────────────
  5551.  
  5552.      ■  Summary
  5553.  
  5554.      vrstrarea(int <vhandle>);
  5555.  
  5556.      ■  Description
  5557.  
  5558.      The vrstrarea function is used to restore a previously saved portion
  5559.      of the screen. <vhandle> is the video information handle returned by a
  5560.      previous call to vsavearea, which saved the screen area.
  5561.  
  5562.      Note, it is very important that <vhandle> is a valid handle, returned
  5563.      by a previous call to vsavearea, or unpredictable results will happen.
  5564.  
  5565.      ■  Return Value
  5566.  
  5567.      None.
  5568.  
  5569.      ■  See Also
  5570.  
  5571.      vsavearea
  5572.  
  5573.  
  5574.      VSAVEAREA
  5575.      ──────────────────────────────────────────────────────────────────────
  5576.  
  5577.      ■  Summary
  5578.  
  5579.      vsavearea(int <x1>, int <y1>, int <x2>, int <y2>);
  5580.  
  5581.      ■  Description
  5582.  
  5583.      The vsavearea function is used to save a rectangular portion of the
  5584.      screen (to be later restored). <x1>,<y1> is the upper left corner of
  5585.      the area to save, while <x2>,<y2> is the lower right corner. Charac-
  5586.      ters (and their colors) currently on the screen in this rectangle are
  5587.      saved in a buffer, and a 'handle' is returned, which must be stored
  5588.      and used in the subsequent call to vrstrarea to restore the saved
  5589.      area. If not enough memory exists to save the video bytes, a value of
  5590.      -1 is returned instead.
  5591.  
  5592.      Note that Telix has only a limited amount of space for allocating to
  5593.      video buffers of this type. At one time, only about as much area as
  5594.      would amount to a full screen should be saved with calls to this func-
  5595.      tion.
  5596.  
  5597.      It is also very important that for every call to this function, there
  5598.      is a subsequent call to vrstrarea. If this is not done, memory will
  5599.      become used up until no more is left.
  5600.      Telix v3.5x - SALT Programming                Built-in Functions    96
  5601.  
  5602.  
  5603.  
  5604.      ■  Return Value
  5605.  
  5606.      An integer value representing a 'handle' to the saved area.
  5607.  
  5608.      ■  See Also
  5609.  
  5610.      vrstrarea
  5611.  
  5612.      ■  Example
  5613.  
  5614.      int vhandle;
  5615.      vhandle = vsavearea(0, 0, 79, 24);  // save the current screen
  5616.      myfunc();                           // call a function
  5617.                                          // which modifies screen
  5618.      vrstrarea(vhandle);                 // restore previous screen
  5619.  
  5620.      WAITFOR
  5621.      ──────────────────────────────────────────────────────────────────────
  5622.  
  5623.      ■  Summary
  5624.  
  5625.      waitfor(str <waitstr>, int <timeout>);
  5626.  
  5627.      ■  Description
  5628.  
  5629.      The waitfor function is used to wait for the given string to come in
  5630.      over the serial port. Timeout is the maximum amount of time, in sec-
  5631.      onds, to wait for the string. Case is not significant, and the string
  5632.      must be no longer than 40 characters.
  5633.  
  5634.      ■  Return Value
  5635.  
  5636.      A non-zero (TRUE) value is returned if the string is received from the
  5637.      serial port in the given time, otherwise a zero (FALSE) value is re-
  5638.      turned.
  5639.  
  5640.      ■  See Also
  5641.  
  5642.      track
  5643.  
  5644.      ■  Example
  5645.  
  5646.      if (waitfor("name?", 180))
  5647.       prints("The string 'name?' came in from the comm port.");
  5648.      else
  5649.       {
  5650.        prints("The string 'name?' did not come in from the");
  5651.        prints("comm port in 3 minutes!");
  5652.       }
  5653.      Telix v3.5x - SALT Programming                  System Variables    97
  5654.  
  5655.  
  5656.  
  5657.      5.  SYSTEM VARIABLES
  5658.  
  5659.      Telix has quite a large number predefined built-in variables. They are
  5660.      called System Variables and are used to store many preferences. There
  5661.      are both string and numeric system variables, and they are accessed
  5662.      just as you would access any other variable. To help distinguish them
  5663.      apart from normal variables, and to avoid confusion, they all start
  5664.      with an underscore (_) character.
  5665.  
  5666.      The following pages contain descriptions of all the system variables.
  5667.      For each variable, a summary and a description are given. An example
  5668.      of actual usage of the variable will often be given.
  5669.  
  5670.      The variables are listed in alphabetical order. So that you may find
  5671.      related variables (and built-in functions), most variable descriptions
  5672.      have a 'See also' section, which lists related variables and func-
  5673.      tions.
  5674.      Telix v3.5x - SALT Programming                  System Variables    98
  5675.  
  5676.  
  5677.  
  5678.      _ADD_LF
  5679.      ──────────────────────────────────────────────────────────────────────
  5680.  
  5681.      ■  Summary
  5682.  
  5683.      int _add_lf;
  5684.  
  5685.      ■  Description
  5686.  
  5687.      If the _add_lf system variable is set to non-zero (TRUE), a Line Feed
  5688.      character is automatically added after every Carriage Return character
  5689.      that comes in.
  5690.  
  5691.  
  5692.      _ALARM_ON
  5693.      ──────────────────────────────────────────────────────────────────────
  5694.  
  5695.      ■  Summary
  5696.  
  5697.      int _alarm_on;
  5698.  
  5699.      ■  Description
  5700.  
  5701.      If the _alarm_on system variable is set to non-zero (TRUE), alarms are
  5702.      enabled in Telix. Note that if the _sound_off system variable is set
  5703.      to zero (FALSE), alarms will not be heard no matter what the state of
  5704.      this variable.
  5705.  
  5706.      ■  See Also
  5707.  
  5708.      alarm
  5709.      _sound_on
  5710.  
  5711.  
  5712.      _ANSWERBACK_STR
  5713.      ──────────────────────────────────────────────────────────────────────
  5714.  
  5715.      ■  Summary
  5716.  
  5717.      str _answerback_str[19];
  5718.  
  5719.      ■  Description
  5720.  
  5721.      The _answerback_str system variable holds the string which Telix will
  5722.      send when a Ctrl-E (ENQ) character is received while in terminal mode.
  5723.      If this string is empty, nothing is sent. Note that if Compuserve B
  5724.      transfers are enabled, the answerback string will not be sent, since
  5725.      CIS B uses the Ctrl-E as part of the transfer process. Maximum length
  5726.      is 19 characters.
  5727.  
  5728.  
  5729.      _ASC_RCRTRANS - _ASC_STRIPH
  5730.      ──────────────────────────────────────────────────────────────────────
  5731.  
  5732.      ■  Summary
  5733.  
  5734.      int _asc_rcrtrans;
  5735.      Telix v3.5x - SALT Programming                  System Variables    99
  5736.  
  5737.  
  5738.  
  5739.      int _asc_remabort;
  5740.  
  5741.      int _asc_rlftrans;
  5742.  
  5743.      int _asc_scpacing;
  5744.  
  5745.      int _asc_scrtrans;
  5746.  
  5747.      int _asc_secho;
  5748.  
  5749.      int _asc_sexpand;
  5750.  
  5751.      int _asc_slftrans;
  5752.  
  5753.      int _asc_slpacing;
  5754.  
  5755.      int _asc_spacechr;
  5756.  
  5757.      int _asc_striph;
  5758.  
  5759.      ■  Description
  5760.  
  5761.      _asc_rcrtrans determines what Telix does with Carriage Return char-
  5762.      acters during ASCII receives. 0 = do nothing; 1 = strip; 2 = add Line
  5763.      Feed afterwards.
  5764.  
  5765.      _asc_remabort is the character which when received from the remote
  5766.      side during an ASCII transfer is a signal to abort the transfer.
  5767.  
  5768.      _asc_rlftrans determines what Telix does with Line Feed characters
  5769.      during ASCII receives. 0 = do nothing; 1 = strip; 2 = add Carriage Re-
  5770.      turn before.
  5771.  
  5772.      _asc_scpacing is the time in milliseconds which Telix should wait be-
  5773.      fore transmitting each character during ASCII sends.
  5774.  
  5775.      _asc_scrtrans determines what Telix does with Carriage Return char-
  5776.      acters during ASCII sends. 0 = do nothing; 1 = strip; 2 = add Line
  5777.      Feed afterwards.
  5778.  
  5779.      If _asc_secho is set to non-zero (TRUE), Telix will echo each char-
  5780.      acter during ASCII sends.
  5781.  
  5782.      If _asc_sexpand is set to non-zero (TRUE), Telix will expand blank
  5783.      lines to a space character, during ASCII sends.
  5784.  
  5785.      _asc_slftran determines what Telix does with Line Feed characters dur-
  5786.      ing ASCII sends. 0 = do nothing; 1 = strip; 2 = add Carriage Return
  5787.      before.
  5788.  
  5789.      _asc_slpacing is the time in tenths of seconds which Telix should wait
  5790.      before transmitting each line during ASCII sends.
  5791.  
  5792.      _asc_spacechr is the character which Telix should wait for during
  5793.      ASCII sends, before transmitting each line (0 means no wait).
  5794.      Telix v3.5x - SALT Programming                 System Variables    100
  5795.  
  5796.  
  5797.  
  5798.      If _asc_striph is set to non-zero (TRUE), Telix will strip the high
  5799.      (most significant) bit of each character in an ASCII transfer.
  5800.  
  5801.  
  5802.      _AUTO_ANS_STR
  5803.      ──────────────────────────────────────────────────────────────────────
  5804.  
  5805.      ■  Summary
  5806.  
  5807.      str _auto_ans_str[48];
  5808.  
  5809.      ■  Description
  5810.  
  5811.      The _auto_ans_str system variable holds the string that should be sent
  5812.      to the modem to make it automatically answer the phone when it rings.
  5813.      This string is used by the Host Mode script, among others. The string
  5814.      will possibly include translation characters as described in the Telix
  5815.      manual in the section by that name, and should be sent to the modem
  5816.      with the cputs_tr function. Maximum length is 49 characters.
  5817.  
  5818.      ■  See Also
  5819.  
  5820.      _mdm_init_str
  5821.  
  5822.  
  5823.      _BACK_COLOR
  5824.      ──────────────────────────────────────────────────────────────────────
  5825.  
  5826.      ■  Summary
  5827.  
  5828.      int _back_color;
  5829.  
  5830.      ■  Description
  5831.  
  5832.      The _back_color system variable contains the background color which
  5833.      should be used for text in terminal mode. Allowable values are from 0
  5834.      - 15. Note that changes to this variable may not be reflected until
  5835.      the screen is cleared.
  5836.  
  5837.      ■  See Also
  5838.  
  5839.      _fore_color
  5840.  
  5841.  
  5842.      _CAPTURE_FNAME
  5843.      ──────────────────────────────────────────────────────────────────────
  5844.  
  5845.      ■  Summary
  5846.  
  5847.      str _capture_fname[64];
  5848.  
  5849.      ■  Description
  5850.  
  5851.      The _capture_fname system variable holds the default capture file
  5852.      filename. The maximum length is 64 characters.
  5853.      Telix v3.5x - SALT Programming                 System Variables    101
  5854.  
  5855.  
  5856.  
  5857.      ■  See Also
  5858.  
  5859.      capture
  5860.      _usage_fname
  5861.  
  5862.  
  5863.      _CISB_AUTO
  5864.      ──────────────────────────────────────────────────────────────────────
  5865.  
  5866.      ■  Summary
  5867.  
  5868.      int _cisb_auto;
  5869.  
  5870.      ■  Description
  5871.  
  5872.      The _cisb_auto system variable controls whether Compuserve Quick B
  5873.      auto file transfer are allowed. If this variable is set to a 0 (FALSE)
  5874.      value, requests by the remote (Compuserve) to transfer files using the
  5875.      Quick B protocol will be ignored.
  5876.  
  5877.      ■  See Also
  5878.  
  5879.      _zmod_auto
  5880.  
  5881.  
  5882.      _CONNECT_STR
  5883.      ──────────────────────────────────────────────────────────────────────
  5884.  
  5885.      ■  Summary
  5886.  
  5887.      str _connect_str[19];
  5888.  
  5889.      ■  Description
  5890.  
  5891.      The _connect_str system variable holds the string which Telix should
  5892.      scan for when dialing, and should take to mean that a connection has
  5893.      been established. For Hayes type modems it is usually set to
  5894.      "CONNECT". Maximum length is 19 characters.
  5895.  
  5896.      ■  See Also
  5897.  
  5898.      _no_connect1 - _no_connect4
  5899.  
  5900.  
  5901.      _DATE_FORMAT
  5902.      ──────────────────────────────────────────────────────────────────────
  5903.  
  5904.      ■  Summary
  5905.  
  5906.      int _date_format;
  5907.  
  5908.      ■  Description
  5909.  
  5910.      The contents of the _date_format system variable determines what for-
  5911.      mat Telix uses for date strings it produces, as follows:
  5912.      Telix v3.5x - SALT Programming                 System Variables    102
  5913.  
  5914.  
  5915.  
  5916.                     0    mm/dd/yy
  5917.                     1    dd/mm/yy
  5918.                     2    yy/mm/dd
  5919.  
  5920.      ■  See Also
  5921.  
  5922.      _time_format
  5923.      date
  5924.  
  5925.  
  5926.      _DEST_BS
  5927.      ──────────────────────────────────────────────────────────────────────
  5928.  
  5929.      ■  Summary
  5930.  
  5931.      int _dest_bs;
  5932.  
  5933.      ■  Description
  5934.  
  5935.      The _dest_bs system variable controls whether a backspace character
  5936.      received by Telix in Terminal Mode erases the character to the left of
  5937.      the cursor, or just moves the cursor on top of it on top of it without
  5938.      erasing it. If this variable is 0 (FALSE), Telix will treat the
  5939.      backspace as non-destructive, and destructive otherwise.
  5940.  
  5941.      ■  See Also
  5942.  
  5943.      _swap_bs
  5944.  
  5945.  
  5946.      _DIAL_PAUSE
  5947.      ──────────────────────────────────────────────────────────────────────
  5948.  
  5949.      ■  Summary
  5950.  
  5951.      int _dial_pause;
  5952.  
  5953.      ■  Description
  5954.  
  5955.      The _dial_pause system variable holds (in seconds) the amount of time
  5956.      to wait between the end of one dialing attempt and the beginning of
  5957.      another. Most modems don't need more than a 1 second pause.
  5958.  
  5959.  
  5960.      _DIAL_TIME
  5961.      ──────────────────────────────────────────────────────────────────────
  5962.  
  5963.      ■  Summary
  5964.  
  5965.      int _dial_time;
  5966.  
  5967.      ■  Description
  5968.  
  5969.      The _dial_time system variable holds the amount of time Telix should
  5970.      wait for a connection when dialing, in seconds (e.g. 30).
  5971.      Telix v3.5x - SALT Programming                 System Variables    103
  5972.  
  5973.  
  5974.  
  5975.      ■  See Also
  5976.  
  5977.      _dial_pause
  5978.  
  5979.  
  5980.      _DIALPOST
  5981.      ──────────────────────────────────────────────────────────────────────
  5982.  
  5983.      ■  Summary
  5984.  
  5985.      str _dialpost[19];
  5986.  
  5987.      ■  Description
  5988.  
  5989.      The _dialpost system variable holds the string (the dialing postfix)
  5990.      which should be sent to the modem after the number, when dialing. For
  5991.      Hayes type modems, it is usually just a Carriage Return. Maximum
  5992.      length is 19 characters. This string will possibly include some trans-
  5993.      lation characters, as described in the Telix manual, and should be
  5994.      sent to the modem with the cputs_tr function.
  5995.  
  5996.      ■  See Also
  5997.  
  5998.      _dialpref, _dialpref2, _dialpref3, _redial_stop
  5999.  
  6000.  
  6001.      _DIALPREF
  6002.      ──────────────────────────────────────────────────────────────────────
  6003.  
  6004.      ■  Summary
  6005.  
  6006.      str _dialpref[19];
  6007.  
  6008.      str _dialpref2[19];
  6009.  
  6010.      str _dialpref3[19];
  6011.  
  6012.      ■  Description
  6013.  
  6014.      The _dialpref system variable holds the string which should be sent to
  6015.      the modem before the number, when dialing. For Hayes type modems, it
  6016.      is usually set to "ATDT". Maximum length is 19 characters. This string
  6017.      will possibly include translation characters, as described in the
  6018.      Telix manual, and should be sent to the modem with the cputs_tr func-
  6019.      tion.
  6020.  
  6021.      The _dialpref2 and _dialpref3 variables are the other two dialing pre-
  6022.      fixes that may be defined in Telix.
  6023.  
  6024.      ■  See Also
  6025.  
  6026.      _dialpost, _redial_stop
  6027.      Telix v3.5x - SALT Programming                 System Variables    104
  6028.  
  6029.  
  6030.  
  6031.      _DIR_PROG
  6032.      ──────────────────────────────────────────────────────────────────────
  6033.  
  6034.      ■  Summary
  6035.  
  6036.      str _dir_prog[15];
  6037.  
  6038.      ■  Description
  6039.  
  6040.      The _dir_prog system variable holds the name of the disk directory
  6041.      program that should be run when the user selects the 'Files directory'
  6042.      option of the DOS Functions menu. If this variable is left empty (""),
  6043.      the DOS 'dir' command is used. Maximum length is 15 characters.
  6044.  
  6045.  
  6046.      _DISP_FREE
  6047.      ──────────────────────────────────────────────────────────────────────
  6048.  
  6049.      ■  Summary
  6050.  
  6051.      int _disp_free
  6052.  
  6053.      ■  Description
  6054.  
  6055.      If the _disp_free system variable is set to non-zero (TRUE), Telix
  6056.      will display the amount of free space available on the drive when the
  6057.      user presses Alt-R to download a file.
  6058.  
  6059.  
  6060.      _DOWN_DIR
  6061.      ──────────────────────────────────────────────────────────────────────
  6062.  
  6063.      ■  Summary
  6064.  
  6065.      str _down_dir[64];
  6066.  
  6067.      ■  Description
  6068.  
  6069.      The _down_dir system variable holds the default download directory
  6070.      name. When a file is downloaded (received), if the user specifies a
  6071.      drive and/or directory in the name, the file is put there. However, if
  6072.      only a name is specified, the file is placed in the directory in-
  6073.      dicated by _down_dir. The maximum length is 64 characters, and this
  6074.      string should end with the backslash character, '\'.
  6075.  
  6076.      ■  See Also
  6077.  
  6078.      _up_dir, receive
  6079.  
  6080.  
  6081.      _EDITOR
  6082.      ──────────────────────────────────────────────────────────────────────
  6083.  
  6084.      ■  Summary
  6085.  
  6086.      str _editor[64];
  6087.      Telix v3.5x - SALT Programming                 System Variables    105
  6088.  
  6089.  
  6090.  
  6091.      ■  Description
  6092.  
  6093.      The _editor system variable holds the name of the editor that should
  6094.      be run when the user presses Alt-A. The editor should either be on the
  6095.      DOS Path, in which case only the name needs to be given, or else the
  6096.      entire pathname (drive, directory, name) must be given. The maximum
  6097.      length is 64 characters. If a batch file is to be run the .BAT exten-
  6098.      sion must be given.
  6099.  
  6100.  
  6101.      _ENTRY_ENUM
  6102.      ──────────────────────────────────────────────────────────────────────
  6103.  
  6104.      ■  Summary
  6105.  
  6106.      int _entry_enum;
  6107.  
  6108.      ■  Description
  6109.  
  6110.      The _entry_enum variable is set by the dialing routines. When a con-
  6111.      nection is established while dialing, the entry number of the dialing
  6112.      directory entry connected to is stored here. If a manual number is
  6113.      connected to, the value 0 is stored here.
  6114.  
  6115.      ■  See Also
  6116.  
  6117.      _entry_name
  6118.      dial, redial
  6119.  
  6120.  
  6121.      _ENTRY_NAME - _ENTRY_PASS
  6122.      ──────────────────────────────────────────────────────────────────────
  6123.  
  6124.      ■  Summary
  6125.  
  6126.      str _entry_name[29];
  6127.  
  6128.      str _entry_num[17];
  6129.  
  6130.      str _entry_pass[14];
  6131.  
  6132.      ■  Description
  6133.  
  6134.      The _entry_name system variable is set by the dialing routines. When a
  6135.      connection has been established the name portion of the dialing direc-
  6136.      tory entry connected to is copied here, for use by script files. The
  6137.      maximum length is 29 characters.
  6138.  
  6139.      The _entry_num system variable is set in the same way, and holds the
  6140.      phone number of the entry connected to. The maximum length is 17 char-
  6141.      acters.
  6142.  
  6143.      The entry_pass system variable is set in the same way, and holds the
  6144.      password from the entry connected to. This may be used to perform lo-
  6145.      gons. The maximum length is 14 characters.
  6146.      Telix v3.5x - SALT Programming                 System Variables    106
  6147.  
  6148.  
  6149.  
  6150.      ■  See Also
  6151.  
  6152.      _entry_enum
  6153.      dial, redial
  6154.  
  6155.  
  6156.      _EXT_FILESPEC;
  6157.      ──────────────────────────────────────────────────────────────────────
  6158.  
  6159.      ■  Summary
  6160.  
  6161.      str _ext_filespec[64];
  6162.  
  6163.      ■  Description
  6164.  
  6165.      This variable is for use by scripts implementing external protocols.
  6166.      When an external protocol has been defined as called by a script, this
  6167.      variable is first loaded with the filespec (file specification) typed
  6168.      by the user at the transfer menu. The appropriate script is then run.
  6169.      The script can for example pass this name to a program which imple-
  6170.      ments the actual protocol. Note that some file transfer protocols do
  6171.      not require the user to supply the name on downloads, in which case
  6172.      this variable is left empty.
  6173.  
  6174.  
  6175.      _FORE_COLOR
  6176.      ──────────────────────────────────────────────────────────────────────
  6177.  
  6178.      ■  Summary
  6179.  
  6180.      int _fore_color;
  6181.  
  6182.      ■  Description
  6183.  
  6184.      The _fore_color system variable contains the foreground color which
  6185.      should be used for text in terminal mode. Allowable values are from 0
  6186.      - 15. Note that changes to this variable may not be reflected until
  6187.      the screen is cleared.
  6188.  
  6189.      ■  See Also
  6190.  
  6191.      _back_color
  6192.  
  6193.  
  6194.      _IMAGE_FILE;
  6195.      ──────────────────────────────────────────────────────────────────────
  6196.  
  6197.      ■  Summary
  6198.  
  6199.      str _image_file[64];
  6200.  
  6201.      ■  Description
  6202.  
  6203.      The _image_file system variable holds the full name of the file that
  6204.      screen images are saved to when the user presses Alt-I while in ter-
  6205.      minal mode. If this file already exists, data is appended to it.
  6206.      Telix v3.5x - SALT Programming                 System Variables    107
  6207.  
  6208.  
  6209.  
  6210.      _LOCAL_ECHO
  6211.      ──────────────────────────────────────────────────────────────────────
  6212.  
  6213.      ■  Summary
  6214.  
  6215.      int _local_echo;
  6216.  
  6217.      ■  Description
  6218.  
  6219.      The _local_echo system variable controls whether or not characters
  6220.      typed in terminal mode are echoed on the screen. If _local_echo is set
  6221.      to non-zero (TRUE), characters are echoed, otherwise they are not.
  6222.  
  6223.  
  6224.      _MDM_HANG_STR
  6225.      ──────────────────────────────────────────────────────────────────────
  6226.  
  6227.      ■  Summary
  6228.  
  6229.      str _mdm_hang_str[19];
  6230.  
  6231.      ■  Description
  6232.  
  6233.      The _mdm_hang_str system variable holds the string that should be sent
  6234.      to the modem to hang it up when the user presses Alt-H. Note that this
  6235.      string will only be sent to the modem if Telix can't first hang-up the
  6236.      modem by turning off a signal on the serial port called the DTR line.
  6237.      This string may contain translation characters as defined in the Telix
  6238.      manual, and should be sent to the modem with the cputs_tr function.
  6239.      Maximum length is 19 characters.
  6240.  
  6241.      ■  See Also
  6242.  
  6243.      _mdm_init_str, _auto_ans_str
  6244.  
  6245.  
  6246.      _MDM_INIT_STR
  6247.      ──────────────────────────────────────────────────────────────────────
  6248.  
  6249.      ■  Summary
  6250.  
  6251.      str _mdm_init_str[49];
  6252.  
  6253.      ■  Description
  6254.  
  6255.      The _mdm_init system variable holds the string that should be sent to
  6256.      the modem when Telix starts-up. It is usually used to make sure cer-
  6257.      tain settings in the modem are right. This string may contain transla-
  6258.      tion characters as defined in the Telix manual, and should be sent to
  6259.      the modem with the cputs_tr function. Maximum length is 49 characters.
  6260.  
  6261.      ■  See Also
  6262.  
  6263.      _auto_ans_str, _mdm_hang_str
  6264.      Telix v3.5x - SALT Programming                 System Variables    108
  6265.  
  6266.  
  6267.  
  6268.      _NO_CONNECT1 - _NO_CONNECT4
  6269.      ──────────────────────────────────────────────────────────────────────
  6270.  
  6271.      ■  Summary
  6272.  
  6273.      str _no_connect1[19];
  6274.  
  6275.      str _no_connect2[19];
  6276.  
  6277.      str _no_connect3[19];
  6278.  
  6279.      str _no_connect4[19];
  6280.  
  6281.      ■  Description
  6282.  
  6283.      These system variables contain the strings that Telix should scan for
  6284.      when dialing, and take to mean that a connection has not been estab-
  6285.      lished (i.e., the number was busy or there was no answer). The maximum
  6286.      length for each string is 19 characters.
  6287.  
  6288.      ■  See Also
  6289.  
  6290.      _connect_str
  6291.  
  6292.  
  6293.      _QDBAR_ON
  6294.      ──────────────────────────────────────────────────────────────────────
  6295.  
  6296.      ■  Summary
  6297.  
  6298.      int _qdbar_on;
  6299.  
  6300.      ■  Description
  6301.  
  6302.      If the _qdbar_on system variable is set to non-zero (TRUE), the quick
  6303.      dialing bar is shown first when Alt-D is pressed; otherwise the user
  6304.      is taken directly to the dialing directory screen.
  6305.  
  6306.  
  6307.      _REDIAL_STOP
  6308.      ──────────────────────────────────────────────────────────────────────
  6309.  
  6310.      ■  Summary
  6311.  
  6312.      str _redial_stop[19];
  6313.  
  6314.      ■  Description
  6315.  
  6316.      The _redial_stop system variable holds the string that should be sent
  6317.      to the modem to stop a dialing attempt. It usually just holds a Car-
  6318.      riage Return character. This string may contain translation characters
  6319.      as described in the Telix manual, and should be sent to the modem with
  6320.      the cputs_tr function. Maximum length is 19 characters.
  6321.  
  6322.      ■  See Also
  6323.  
  6324.      _dialpref, _dialpref2, _dialpref3, _dialpost
  6325.      Telix v3.5x - SALT Programming                 System Variables    109
  6326.  
  6327.  
  6328.  
  6329.      _SCR_CHK_KEY
  6330.      ──────────────────────────────────────────────────────────────────────
  6331.  
  6332.      ■  Summary
  6333.  
  6334.      int _scr_chk_key;
  6335.  
  6336.      ■  Description
  6337.  
  6338.      Between every command while executing a script file, Telix checks the
  6339.      keyboard buffer to see if the user has requested an abort. This how-
  6340.      ever gets in the way of the inkey function among others. As well, it
  6341.      is sometimes necessary to stop the user from being able to abort the
  6342.      script. If _scr_chk_key is set to zero (FALSE), Telix will no longer
  6343.      check for user aborts requests during script execution. Setting it
  6344.      back to non-zero (TRUE) will turn the checks back on. When modifying
  6345.      this variable in a script file, it is a good idea to save the old
  6346.      state in a scratch variable and restore it when done.
  6347.  
  6348.      ■  See Also
  6349.  
  6350.      inkey
  6351.  
  6352.  
  6353.      _SCRIPT_DIR
  6354.      ──────────────────────────────────────────────────────────────────────
  6355.  
  6356.      ■  Summary
  6357.  
  6358.      str _script_dir[64];
  6359.  
  6360.      ■  Description
  6361.  
  6362.      The _script_dir system variable holds the full path of the directory
  6363.      where Telix should look for compiled script files when a script is se-
  6364.      lected to be run. When a script is selected to be run, Telix uses this
  6365.      procedure: if the name includes the drive and/or directory, only that
  6366.      path is searched. If the name includes only the filename, the current
  6367.      directory is first searched for the script file, and then the direc-
  6368.      tory pointed to by the _script_dir variable. This string should end in
  6369.      the slash character, '\'. The maximum allowed length is 64 characters.
  6370.  
  6371.      ■  See Also
  6372.  
  6373.      _telix_dir, _up_dir, _down_dir
  6374.  
  6375.  
  6376.      _SOUND_ON
  6377.      ──────────────────────────────────────────────────────────────────────
  6378.  
  6379.      ■  Summary
  6380.  
  6381.      int _sound_on;
  6382.      Telix v3.5x - SALT Programming                 System Variables    110
  6383.  
  6384.  
  6385.  
  6386.      ■  Description
  6387.  
  6388.      If the _sound_on system variable is set to non-zero (TRUE) sound is
  6389.      enabled in Telix, otherwise all sound is shut off.
  6390.  
  6391.      ■  See Also
  6392.  
  6393.      _alarm_on
  6394.  
  6395.  
  6396.      _STRIP_HIGH
  6397.      ──────────────────────────────────────────────────────────────────────
  6398.  
  6399.      ■  Summary
  6400.  
  6401.      int _strip_high;
  6402.  
  6403.      ■  Description
  6404.  
  6405.      The _strip_high system variable controls what Telix does with the high
  6406.      (most significant) bit of incoming characters while in terminal mode.
  6407.      If this variable is set to s non-zero (TRUE) value, Telix will strip
  6408.      the high bit of incoming characters.
  6409.  
  6410.  
  6411.      _SWAP_BS
  6412.      ──────────────────────────────────────────────────────────────────────
  6413.  
  6414.      ■  Summary
  6415.  
  6416.      int _swap_bs;
  6417.  
  6418.      ■  Description
  6419.  
  6420.      The _swap_bs system variable controls what Telix sends when the
  6421.      Backspace key is pressed. If this variable is 0, Telix will send a
  6422.      Backspace character when Backspace is pressed, and a DEL character
  6423.      when Ctrl-Backspace is pressed. If this variable is set to 1, Telix
  6424.      will reverse these codes.
  6425.  
  6426.      ■  See Also
  6427.  
  6428.      _dest_bs
  6429.  
  6430.  
  6431.      _TELIX_DIR;
  6432.      ──────────────────────────────────────────────────────────────────────
  6433.  
  6434.      ■  Summary
  6435.  
  6436.      str _telix_dir[64];
  6437.  
  6438.      ■  Description
  6439.  
  6440.      The _telix_dir system variable holds the full path to reach the Telix
  6441.      program's base directory (e.g. 'C:\TELIX\'). Changing this variable is
  6442.      not recommended, as if a wrong value is used, Telix will probably not
  6443.      Telix v3.5x - SALT Programming                 System Variables    111
  6444.  
  6445.  
  6446.  
  6447.      be able to find many needed files. The maximum length is 64 charac-
  6448.      ters.
  6449.  
  6450.      If this variable is changed, it is imperative that a backslash char-
  6451.      acter, '\', is found at the end. Telix builds paths to many files by
  6452.      appending certain names to this string. If the slash is missing, it
  6453.      will cause many problems.
  6454.  
  6455.      ■  See Also
  6456.  
  6457.      _script_dir, _up_dir, _down_dir
  6458.  
  6459.  
  6460.      _TIME_FORMAT
  6461.      ──────────────────────────────────────────────────────────────────────
  6462.  
  6463.      ■  Summary
  6464.  
  6465.      int _time_format;
  6466.  
  6467.      ■  Description
  6468.  
  6469.      The _time_format system variable determines what format Telix uses for
  6470.      time strings it produces. If _time_format is 0, Telix will use a 12
  6471.      hour format, otherwise a 24 hour format will be used.
  6472.  
  6473.      ■  See Also
  6474.  
  6475.      _date_format
  6476.      time
  6477.  
  6478.  
  6479.      _UP_DIR
  6480.      ──────────────────────────────────────────────────────────────────────
  6481.  
  6482.      ■  Summary
  6483.  
  6484.      str _up_dir[64];
  6485.  
  6486.      ■  Description
  6487.  
  6488.      The _up_dir system variable holds the default upload directory name.
  6489.      When a file is to be ed (sent), if the user specifies a drive and/or
  6490.      directory in the name, the file is taken from there. However, if only
  6491.      a name is specified, the file is searched for in the directory in-
  6492.      dicated by _up_dir. This variable should end with a slash character,
  6493.      '\'. The maximum length is 64 characters.
  6494.  
  6495.      ■  See Also
  6496.  
  6497.      _down_dir
  6498.      send
  6499.      Telix v3.5x - SALT Programming                 System Variables    112
  6500.  
  6501.  
  6502.  
  6503.      _USAGE_FNAME
  6504.      ──────────────────────────────────────────────────────────────────────
  6505.  
  6506.      ■  Summary
  6507.  
  6508.      str _usage_fname[64];
  6509.  
  6510.      ■  Description
  6511.  
  6512.      The _usage_fname system variable holds the default Usage Log filename.
  6513.      The maximum length is 64 characters.
  6514.  
  6515.      ■  See Also
  6516.  
  6517.      _capture_fname
  6518.      usagelog
  6519.  
  6520.  
  6521.      _ZMOD_AUTO
  6522.      ──────────────────────────────────────────────────────────────────────
  6523.  
  6524.      ■  Summary
  6525.  
  6526.      int _zmod_auto;
  6527.  
  6528.      ■  Description
  6529.  
  6530.      The _zmod_auto system variable controls whether or not Zmodem auto-
  6531.      downloads are allowed. If Telix is in terminal mode and receives an
  6532.      auto download request Telix will ignore it if this variable is set to
  6533.      a 0 (FALSE) value (however, the user can still receive the file by
  6534.      manually selecting the Zmodem protocol from the Alt-R menu).
  6535.  
  6536.      ■  See Also
  6537.  
  6538.      _cisb_auto
  6539.  
  6540.  
  6541.      _ZMOD_RCRASH
  6542.      ──────────────────────────────────────────────────────────────────────
  6543.  
  6544.      ■  Summary
  6545.  
  6546.      int _zmod_rcrash;
  6547.  
  6548.      ■  Description
  6549.  
  6550.      The _zmod_rcrash system variable controls whether the Zmodem receive
  6551.      Crash Recovery (resume) option is on. If this variable is set to a
  6552.      non-zero (TRUE) value, Telix will try to resume aborted transfers dur-
  6553.      ing a Zmodem download.
  6554.  
  6555.      ■  See Also
  6556.  
  6557.      _zmod_scrash
  6558.      Telix v3.5x - SALT Programming                 System Variables    113
  6559.  
  6560.  
  6561.  
  6562.      _ZMOD_SCRASH
  6563.      ──────────────────────────────────────────────────────────────────────
  6564.  
  6565.      ■  Summary
  6566.  
  6567.      int _zmod_scrash;
  6568.  
  6569.      ■  Description
  6570.  
  6571.      The _zmod_scrash system variable controls whether the Zmodem send
  6572.      Crash Recovery (resume) option is on. If this variable is set to a
  6573.      non-zero (TRUE) value, Telix will try to tell the other side to resume
  6574.      aborted transfers during a Zmodem upload.
  6575.  
  6576.      ■  See Also
  6577.  
  6578.      _zmod_rcrash
  6579.      Telix v3.5x                                          Appendix A    114
  6580.  
  6581.  
  6582.  
  6583.      6.  APPENDIX A - ASCII CHARACTER SET
  6584.  
  6585.      The ASCII character set consists if 128 characters, with each char-
  6586.      acter having an ASCII value, in the range of 0 to 127. The IBM PC uses
  6587.      the IBM Extended ASCII set, which adds a further 128 values, to pro-
  6588.      vide extra symbols. The following table lists the regular ASCII char-
  6589.      acter set. The first column contains the ASCII control characters,
  6590.      which can not normally be printed, and are given by name.
  6591.  
  6592.      Dec Hex Ctrl Name    Dec Hex Chr   Dec Hex Chr     Dec Hex Chr
  6593.        0  00  ^@  NUL      32  20         64  40  @      96  60  `
  6594.        1  01  ^A  SOH      33  21  !      65  41  A      97  61  a
  6595.        2  02  ^B  STX      34  22  "      66  42  B      98  62  b
  6596.        3  03  ^C  ETX      35  23  #      67  43  C      99  63  c
  6597.        4  04  ^D  EOT      36  24  $      68  44  D     100  64  d
  6598.        5  05  ^E  ENQ      37  25  %      69  45  E     101  65  e
  6599.        6  06  ^F  ACK      38  26  &      70  46  F     102  66  f
  6600.        7  07  ^G  BEL      39  27  '      71  47  G     103  67  g
  6601.        8  08  ^H  BS       40  28  (      72  48  H     104  68  h
  6602.        9  09  ^I  HT       41  29  )      73  49  I     105  69  i
  6603.       10  0a  ^J  LF       42  2a  *      74  4a  J     106  6a  j
  6604.       11  0b  ^K  VT       43  2b  +      75  4b  K     107  6b  k
  6605.       12  0c  ^L  FF       44  2c  ,      76  4c  L     108  6c  l
  6606.       13  0d  ^M  CR       45  2d  -      77  4d  M     109  6d  m
  6607.       14  0e  ^N  SO       46  2e  .      78  4e  N     110  6e  n
  6608.       15  0f  ^O  SI       47  2f  /      79  4f  O     111  6f  o
  6609.       16  10  ^P  DLE      48  30  0      80  50  P     112  70  p
  6610.       17  11  ^Q  DC1      49  31  1      81  51  Q     113  71  q
  6611.       18  12  ^R  DC2      50  32  2      82  52  R     114  72  r
  6612.       19  13  ^S  DC3      51  33  3      83  53  S     115  73  s
  6613.       20  14  ^T  DC4      52  34  4      84  54  T     116  74  t
  6614.       21  15  ^U  NAK      53  35  5      85  55  U     117  75  u
  6615.       22  16  ^V  SYN      54  36  6      86  56  V     118  76  v
  6616.       23  17  ^W  ETB      55  37  7      87  57  W     119  77  w
  6617.       24  18  ^X  CAN      56  38  8      88  58  X     120  78  x
  6618.       25  19  ^Y  EM       57  39  9      89  59  Y     121  79  y
  6619.       26  1a  ^Z  SUB      58  3a  :      90  5a  Z     122  7a  z
  6620.       27  1b  ^[  ESC      59  3b  ;      91  5b  [     123  7b  {
  6621.       28  1c  ^\  FS       60  3c  <      92  5c  \     124  7c  |
  6622.       29  1d  ^]  GS       61  3d  =      93  5d  ]     125  7d  }
  6623.       30  1e  ^^  RS       62  3e  >      96  5e  ^     126  7e  ~
  6624.       31  1f  ^_  US       63  3f  ?      95  5f  _     127  7f DEL
  6625.      Telix v3.5x                                          Appendix B    115
  6626.  
  6627.  
  6628.  
  6629.      7.  APPENDIX B - EXTENDED KEY SCAN CODES
  6630.  
  6631.      The following chart lists keyboard scan codes for special non-ASCII
  6632.      keys, as returned by inkey and inkeyw, and used by the keyget, keyset,
  6633.      keyload, and keysave SALT functions. Normal keys which are within the
  6634.      ASCII set are listed in the preceding appendix.
  6635.  
  6636.  
  6637.      Key      Normal        w / Ctrl        w / Alt       w / Shift
  6638.             Dec     Hex    Dec     Hex    Dec     Hex    Dec     Hex
  6639.      ---------------------------------------------------------------
  6640.      F1     15104  3b00    24064  5e00    26624  6800    21504  5400
  6641.      F2     15360  3c00    24320  5f00    26880  6900    21760  5500
  6642.      F3     15616  3d00    24576  6000    27136  6a00    22016  5600
  6643.      F4     15872  3e00    24832  6100    27392  6b00    22272  5700
  6644.      F5     16128  3f00    25088  6200    27648  6c00    22528  5800
  6645.      F6     16384  4000    25344  6300    27904  6d00    22784  5900
  6646.      F7     16640  4100    25600  6400    28160  6e00    23040  5a00
  6647.      F8     16896  4200    25856  6500    28416  6f00    23296  5b00
  6648.      F9     17152  4300    26112  6600    28672  7000    23552  5c00
  6649.      F10    17408  4400    26368  6700    28928  7100    23808  5d00
  6650.      ---------------------------------------------------------------
  6651.      1                                    30720  7800
  6652.      2                                    30976  7900
  6653.      3                                    31232  7a00
  6654.      4                                    31488  7b00
  6655.      5                                    31744  7c00
  6656.      6                                    32000  7d00
  6657.      7                                    32256  7e00
  6658.      8                                    32512  7f00
  6659.      9                                    32768  8000
  6660.      0                                    33024  8100
  6661.      ---------------------------------------------------------------
  6662.      Up     18432  4800
  6663.      Down   20480  5000
  6664.      Left   19200  4b00    29640  7300
  6665.      Right  19712  4d00    29696  7400
  6666.      Home   18176  4700    30464  7700
  6667.      End    20224  4f00    29952  7500
  6668.      PgUp   18688  4900    33792  8400
  6669.      PgDn   20736  5100    30208  7600
  6670.      Ins    20992  5200
  6671.      Del    21248  5300
  6672.      ---------------------------------------------------------------
  6673.      Telix v3.5x                                          Appendix C    116
  6674.  
  6675.  
  6676.  
  6677.      8.  APPENDIX C - COLOR VALUES
  6678.  
  6679.      Several SALT functions, such as pstra, use color attribute values. A
  6680.      character on the text screen has a foreground color, and a background
  6681.      color. Possible colors are numbered as follows:
  6682.  
  6683.                          Black          00
  6684.                          Blue           01
  6685.                          Green          02
  6686.                          Cyan           03
  6687.                          Red            04
  6688.                          Magenta        05
  6689.                          Brown          06
  6690.                          Light Grey     07
  6691.                          Dark Grey      08
  6692.                          Light Blue     09
  6693.                          Light Green    10
  6694.                          Light Cyan     11
  6695.                          Light Red      12
  6696.                          Light Magenta  13
  6697.                          Yellow         14
  6698.                          White          15
  6699.  
  6700.      To obtain a color attribute value for a color combination, the formula
  6701.      is
  6702.  
  6703.           color attribute value =
  6704.  
  6705.                 foreground color value + (16 * background color value)
  6706.  
  6707.      Therefore, a Yellow character on a Blue background would have a color
  6708.      attribute value of 30 (14 + (16 * 1)).
  6709.  
  6710.      Telix v3.5x - SALT Programming                            Index    117
  6711.  
  6712.  
  6713.                                           _time_format.................111
  6714.                                           _up_dir......................111
  6715.      9.  INDEX                            _usage_fname.................112
  6716.                                           _zmod_auto...................112
  6717.      _add_lf.......................98     _zmod_rcrash.................112
  6718.      _alarm_on.....................98     _zmod_scrash.................113
  6719.      _answerback_str...............98     Alarm.........................22
  6720.      _asc_rcrtrans.................98     Box...........................22
  6721.      _asc_remabort.................99     Call..........................23
  6722.      _asc_rlftrans.................99     Calld.........................23
  6723.      _asc_scpacing.................99     Capture.......................24
  6724.      _asc_scrtrans.................99     Capture_stat..................25
  6725.      _asc_secho....................99     Carrier.......................25
  6726.      _asc_sexpand..................99     Cgetc.........................26
  6727.      _asc_slftrans.................99     Cgetct........................26
  6728.      _asc_slpacing.................99     Chatmode......................27
  6729.      _asc_spacechr.................99     Cinp_cnt......................27
  6730.      _asc_striph...................99     Clear_scr.....................28
  6731.      _auto_ans_str................100     Copychrs......................28
  6732.      _back_color..................100     Copystr.......................29
  6733.      _capture_fname...............100     Cputc.........................29
  6734.      _cisb_auto...................101     Cputs.........................30
  6735.      _connect_str.................101     Cputs_tr......................30
  6736.      _date_format.................101     Cursor_onoff..................31
  6737.      _dest_bs.....................102     Curtime.......................31
  6738.      _dial_pause..................102     Date..........................32
  6739.      _dial_time...................102     Delay.........................32
  6740.      _dialpost....................103     Delay_scr.....................32
  6741.      _dialpref....................103     Delchrs.......................33
  6742.      _dialpref2...................103     Dial..........................33
  6743.      _dialpref3...................103     Dos...........................34
  6744.      _dir_prog....................104     Dosfunction...................35
  6745.      _disp_free...................104     Exittelix.....................35
  6746.      _down_dir....................104     Fclearerr.....................36
  6747.      _editor......................104     Fclose........................36
  6748.      _entry_enum..................105     Fdelete.......................37
  6749.      _entry_name..................105     Feof..........................37
  6750.      _entry_num...................105     Ferror........................38
  6751.      _entry_pass..................105     Fflush........................39
  6752.      _ext_filespec................106     Fgetc.........................39
  6753.      _fore_color..................106     Fgets.........................40
  6754.      _image_file..................106     Fileattr......................40
  6755.      _local_echo..................107     Filefind......................42
  6756.      _mdm_hang_str................107     Filesize......................43
  6757.      _mdm_init_str................107     Filetime......................43
  6758.      _no_connect1.................108     Flushbuf......................45
  6759.      _no_connect2.................108     Fnstrip.......................45
  6760.      _no_connect3.................108     Fopen.........................46
  6761.      _no_connect4.................108     Fputc.........................47
  6762.      _qdbar_on....................108     Fputs.........................47
  6763.      _redial_stop.................108     Fread.........................48
  6764.      _scr_chk_key.................109     Frename.......................48
  6765.      _script_dir..................109     Fseek.........................49
  6766.      _sound_on....................109     Ftell.........................50
  6767.      _strip_high..................110     Fwrite........................50
  6768.      _swap_bs.....................110     Get_baud......................51
  6769.      _telix_dir...................110     Get_datab.....................51
  6770.  
  6771.      Telix v3.5x - SALT Programming                            Index    118
  6772.  
  6773.  
  6774.      Get_parity....................52     Strmaxlen.....................78
  6775.      Get_port......................52     Strpos........................78
  6776.      Get_stopb.....................53     Strposi.......................78
  6777.      Getenv........................51     Strupper......................79
  6778.      Gets..........................53     Subchr........................79
  6779.      Getsxy........................54     Subchrs.......................80
  6780.      Getx, gety....................55     Substr........................80
  6781.      Gotoxy........................55     Tday..........................81
  6782.      Hangup........................56     Terminal......................82
  6783.      Helpscreen....................56     Thour.........................81
  6784.      Inkey.........................56     Time..........................83
  6785.      Inkeyw........................56     Time_up.......................84
  6786.      Inschrs.......................57     Timer_free....................84
  6787.      Is_loaded.....................58     Timer_restart.................84
  6788.      Isalnum.......................58     Timer_start...................84
  6789.      Isalpha.......................58     Timer_total...................84
  6790.      Isascii.......................58     Tmin..........................81
  6791.      Iscntrl.......................58     Tmonth........................81
  6792.      Isdigit.......................58     Tolower.......................85
  6793.      Islower.......................58     Tone..........................85
  6794.      Isupper.......................58     Toupper.......................86
  6795.      Itos..........................59     Track.........................86
  6796.      Keyget........................59     Track_addchr..................86
  6797.      Keyload.......................60     Track_free....................86
  6798.      Keysave.......................61     Track_hit.....................86
  6799.      Keyset........................61     Transtab......................88
  6800.      Load_scr......................62     Tsec..........................81
  6801.      Loadfon.......................62     Tyear.........................81
  6802.      Newdir........................63     Unload_scr....................89
  6803.      Printc........................63     Update_term...................89
  6804.      Printer.......................64     Usage_stat....................90
  6805.      Printn........................64     Usagelog......................90
  6806.      Prints........................65     Ustamp........................91
  6807.      Printsc.......................65     Vgetchr.......................92
  6808.      Printsc_trm...................65     Vgetchrs......................92
  6809.      Pstra.........................65     Vgetchrsa.....................92
  6810.      Pstraxy.......................65     Vputchr.......................93
  6811.      Receive.......................66     Vputchrs......................96
  6812.      Redial........................67     Vputchrsa.....................96
  6813.      Run...........................68     Vrstrarea.....................95
  6814.      Scroll........................69     Vsavearea.....................95
  6815.      Send..........................69     Waitfor.......................96
  6816.      Send_brk......................70
  6817.      Set_cparams...................70
  6818.      Set_defprot...................71
  6819.      Set_port......................73
  6820.      Set_terminal..................73
  6821.      Setchr........................72
  6822.      Setchrs.......................72
  6823.      Show_directory................74
  6824.      Status_wind...................74
  6825.      Stoi..........................75
  6826.      Strcat........................75
  6827.      Strchr........................76
  6828.      Strcmpi.......................76
  6829.      Strlen........................77
  6830.      Strlower......................77
  6831.