home *** CD-ROM | disk | FTP | other *** search
/ BlastDOS / Telix.rar / Telix / SALT.DOC < prev    next >
Text File  |  1993-10-11  |  214KB  |  6,734 lines

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