home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / CO / CO018.ZIP / TLX312-4.ZIP / SALT.DOC < prev   
Text File  |  1989-12-11  |  217KB  |  7,304 lines

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