home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / GENUTIL / FKFOS102.ZIP / FUNCTION.REF < prev    next >
Text File  |  1994-12-27  |  25KB  |  542 lines

  1.                            ________________________
  2.  
  3.                            PROCEDURES AND FUNCTIONS
  4.                            ________________________
  5.  
  6.              The following guide is a quick reference chart to all procedures
  7.         and functions that FKFOSSIL provides.  There are several modifier
  8.         variables that affect the operation of these subroutines, and are
  9.         listed in the section "VARIABLES AND CONSTANTS" in the main
  10.         FKFOSSIL.DOC file.
  11.  
  12.  
  13.         FK_ANSIMUSIC
  14.         ---------------------------------------------------------------------
  15.         Procedure fk_AnsiMusic( s : string );
  16.  
  17.         fk_AnsiMusic will play the music string locally and then send it
  18.         to the remote side. NOTE; Ansi Music is not an ANSI standard -- it
  19.         only uses the term ansi because the string starts with the escape
  20.         sequence #27[.  Not all terminal programs will support Ansi Music
  21.         if they support Ansi - check with user before sending anything
  22.         with fk_AnsiMusic.
  23.  
  24.         The format of the music string "s" is like any BASIC PLAY statement,
  25.         with a few minor exceptions.  The commands are noted below;
  26.  
  27.             A..G    Play musical note
  28.                        If followed by a number, that will be the note length
  29.                           (ignoring the preset length) -- ie, A4 will play "A"
  30.                           as a quarter note
  31.                        If followed by a # or + the note will be played sharp.
  32.                        If followed by a - the note will be played flat.
  33.                        If followed by any number of . (periods), the note
  34.                           length will be multiplied by 3/2 for each period
  35.                           (making the note last a little longer).
  36.             L n     Set the length of the note to n (1..64)
  37.             MN      Music Normal -- each note plays 7/8 length
  38.             ML      Music legato -- each note plays full length
  39.             MS      Music Staccato -- each note plays 3/4 length
  40.             O n     Set the octave number to n (0..6)
  41.             P       Pause (rest)
  42.                        If followed by a number, the pause will ignore the
  43.                           preset length and use the number as the length.
  44.             T n     Set the tempo of the music to n (32..255)
  45.             >       Increase octave one step
  46.             <       Decrease octave one step
  47.  
  48.  
  49.         FK_BS
  50.         ---------------------------------------------------------------------
  51.         Procedure fk_BS( n : integer );
  52.  
  53.         fk_BS will send backspace characters "n" times to effectively back the
  54.         cursor up over already typed information.  The cursor however will
  55.         not backup past column 1 on any given line.
  56.  
  57.  
  58.         FK_CLOCK
  59.         ---------------------------------------------------------------------
  60.         Procedure fk_Clock( b : boolean );
  61.  
  62.         fk_Clock will turn off/on the timer clock.  If B is set to false,
  63.         the timer will be turned off.  If B is set to true, the timer will
  64.         be turned back on again.
  65.  
  66.  
  67.         FK_CLREOL
  68.         ---------------------------------------------------------------------
  69.         Procedure fk_ClrEol;
  70.  
  71.         fk_ClrEol will clear to the end of the line in ANSI or Avatar mode.
  72.         If the user is in TTY mode, fk_ClrEol will do nothing.
  73.  
  74.  
  75.         FK_CLRSCR
  76.         ---------------------------------------------------------------------
  77.         Procedure fk_ClrScr;
  78.  
  79.         fk_ClrScr will clear the screen (local and remote) in any emulation
  80.         mode.  For ASCII/Avatar, CHR(12) is sent, and in ANSI mode #27[2J is
  81.         sent.
  82.  
  83.  
  84.         FK_DEINITFOSSIL
  85.         ---------------------------------------------------------------------
  86.         Procedure fk_DeInitFossil;
  87.  
  88.         fk_DeInitFossil will release the fossil driver (if running remotely)
  89.         and remove the status line if active, and then exit the program.
  90.  
  91.         NOTE; this should be the LAST line in your source code.  All files,
  92.         and any clean up routines should be called before this procedure is
  93.         run (or see the section "DEFINABLE FUNCTIONS").
  94.  
  95.  
  96.         FK_DETECTANSI
  97.         ---------------------------------------------------------------------
  98.         Function fk_DetectAnsi : Boolean;
  99.  
  100.         fk_DetectAnsi sends out the cursor placement query to the user, and
  101.         checks for any response.  If a response comes, then ANSI is present
  102.         and fk_DetectAnsi returns TRUE, otherwise if no response if
  103.         forthcoming and the timer reaches 0, fk_DetectAnsi returns FALSE.
  104.  
  105.         This function does not set the users screen type.  If you want it to,
  106.         you will need to do it yourself -- the procedure is only provided to
  107.         allow you to check for Ansi.
  108.  
  109.  
  110.         FK_DETECTAVATAR
  111.         ---------------------------------------------------------------------
  112.         Function fk_DetectAvatar : boolean;
  113.  
  114.         fk_DetectAvatar sends out the ANSI cursor placement query, and 
  115.         stores the X screen co-ordinates.  If no response comes and the 
  116.         timer reaches 0, fk_DetectAvatar returns FALSE.  If the response 
  117.         does come, an avatar repetition sequence is sent to the modem, and 
  118.         the cursor placement query is sent again.  If the X co-ordinates 
  119.         move by more then 5 characters, fk_DetectAvatar returns TRUE, 
  120.         otherwise it returns FALSE (because the other terminal did not 
  121.         process the avatar sequence correctly).
  122.  
  123.         This function does not set the users screen type.  If you want it to,
  124.         you will need to do it yourself -- the procedure is only provided to
  125.         allow you to check for Avatar.
  126.  
  127.  
  128.         FK_DISPLAY
  129.         ---------------------------------------------------------------------
  130.         Procedure fk_Display( s : string );
  131.  
  132.         fk_Display will send a file "s" to the local and remote screens.  The
  133.         "s" variable should be a full path, filename and extension to a valid
  134.         file.  If the user is in ANSI mode, ansi codes will be accepted.  If
  135.         the user is in Avatar mode, Avatar codes will be accepted.  If the
  136.         user is in TTY mode, straight text is expected.
  137.  
  138.         The better alternative to this procedure is FK_DISPLAYFILE; the
  139.         alternate procedure requires no extension and automatically selects
  140.         the most appropriate file (and if it doesn't exist, a fallback is
  141.         chosen).  If you need to access files with odd extensions, then this
  142.         procedure will prove useful.
  143.  
  144.  
  145.         FK_DISPLAYFILE
  146.         ---------------------------------------------------------------------
  147.         Procedure fk_Displayfile( s : string );
  148.  
  149.         fk_Displayfile will send a file "s" to the local and remote screens.
  150.         Any extension passed in "s" will automatically be stripped, and an
  151.         appropriate extension (based on the users screen setting) will be
  152.         selected.
  153.  
  154.                 TTY             ->  .ASC
  155.                 Ansi            ->  .ANS
  156.                 Avatar          ->  .AVT
  157.  
  158.         If in Avatar/Ansi mode the file isn't found with .ANS or .AVT
  159.         extensions, the fallback will be to .ASC extensions.  So if any file
  160.         needs to exist, it should always be the .ASC file as it will always
  161.         be the fallback file if none of the others are found.
  162.  
  163.  
  164.         FK_FLUSHINPUTBUFFER
  165.         ---------------------------------------------------------------------
  166.         Procedure fk_FlushInputBuffer;
  167.  
  168.         fk_FlushInputBuffer will clear the inbound keyboard buffers and
  169.         fossil buffers so that no keystrokes are left pending.  It's a good
  170.         idea to call this before any important queries.
  171.  
  172.  
  173.         FK_FLUSHOUTPUTBUFFER
  174.         ---------------------------------------------------------------------
  175.         Procedure fk_FlushOutputBuffer;
  176.  
  177.         fk_FlushOutputBuffer will clear the outbound modem buffer if there is
  178.         anything still in the buffer.  It is a good idea to call this before
  179.         hanging up or dropping the DTR, etc...
  180.  
  181.  
  182.         FK_GOTOXY
  183.         ---------------------------------------------------------------------
  184.         Procedure fk_GotoXY( X,Y : Byte );
  185.  
  186.         fk_GotoXY will position the cursor at the (X,Y) coordinates on the
  187.         screen.  This function will only work with ANSI or Avatar modes
  188.         selected.
  189.  
  190.  
  191.         FK_INITFOSSIL
  192.         ---------------------------------------------------------------------
  193.         Procedure fk_InitFossil( Port,
  194.                                  BPSrate,
  195.                                  Lockedrate    : Longint;
  196.                                  Name,
  197.                                  Handle        : String;
  198.                                  Timeleft      : Longint;
  199.                                  Screentype,
  200.                                  StatuslinePos : Byte );
  201.  
  202.         fk_InitFossil should be called BEFORE any other FKFOSSIL modem
  203.         related routines are called.  This will initialize the fossil driver
  204.         and setup the minimal variables that FKFOSSIL requires to run (such
  205.         as user timeleft, screen mode, etc...).
  206.  
  207.         Setting the BPSrate to 0 will cause FKFOSSIL to assume a local
  208.         orientation.
  209.  
  210.         Setting the StatuslinePos to 0 will cause the statusline to not be
  211.         shown until it is set to something other then 0.
  212.  
  213.  
  214.         FK_INITFOSSIL_DF
  215.         ---------------------------------------------------------------------
  216.         fk_InitFossil_DF( StatuslinePos : Byte);
  217.  
  218.         fk_InitFossil_DF is an alternative to fk_InitFossil when you are
  219.         using the DOOR DROP FILES.  Since the DOOR DROP FILE routines
  220.         automatically read the information into the necessary variables, it
  221.         is not required to set them again via fk_InitFossil.
  222.  
  223.  
  224.         FK_IDLETICK
  225.         ---------------------------------------------------------------------
  226.         Procedure fk_Idletick;
  227.  
  228.         fk_Idletick gives up timeslices to various multitasking programs --
  229.         OS/2, DESQview, DOS and Windows are all supported.  This procedure is
  230.         automatically called when an FKFOSSIL routine is polling the
  231.         keyboard, but just in case you need it for something, here it is.
  232.  
  233.  
  234.         FK_KEYPRESSED
  235.         ---------------------------------------------------------------------
  236.         Function fk_Keypressed : Boolean;
  237.  
  238.         fk_Keypressed returns TRUE if there are keys in the keyboard buffer
  239.         or fossil buffer that are waiting to be read.
  240.  
  241.  
  242.         FK_LOCALBUFFER
  243.         ---------------------------------------------------------------------
  244.         Procedure fk_LocalBuffer( s : string );
  245.  
  246.         fk_LocalBuffer will add the string of characters "s" to the inbound 
  247.         local keyboard buffer.  This can be used to add characters as if 
  248.         the local keyboard actually typed in those keys.  (For remote
  249.         buffer, see FK_REMOTEBUFFER)
  250.  
  251.  
  252.         FK_LOCALBUFFERCLEAR
  253.         ---------------------------------------------------------------------
  254.         Procedure fk_LocalBufferClear;
  255.  
  256.         fk_LocalBufferClear will empty the buffer of stored characters.  
  257.         This function does not empty the systems keyboard buffer.  
  258.         fk_FlushInputBuffer will also empty the stored buffer.
  259.  
  260.  
  261.         FK_MOVECURSOR
  262.         ---------------------------------------------------------------------
  263.         Procedure fk_MoveCursor( n : byte;
  264.                                  dir : char );
  265.  
  266.         fk_MoveCursor will move the cursor n times in the direction of "dir".
  267.         Dir should be any of the following;
  268.  
  269.                        U    Up              L    Left
  270.                        D    Down            R    Right
  271.  
  272.         This function will only work in ANSI or Avatar modes.
  273.  
  274.  
  275.         FK_NOWAITREAD
  276.         ---------------------------------------------------------------------
  277.         function fk_NoWaitRead : Char;
  278.  
  279.         fk_NoWaitRead will poll the keyboard if there are any characters
  280.         waiting.  If characters are found in the local or remote buffers,
  281.         then the character will be returned by fk_NoWaitRead.
  282.  
  283.  
  284.         FK_READ
  285.         ---------------------------------------------------------------------
  286.         Function fk_Read : Char;
  287.  
  288.         fk_Read will poll the keyboard for any waiting characters.  If none
  289.         are found, fk_Read will wait until there are some (or the last
  290.         keypress timer runs out).  When a character is found, it will be
  291.         returned by fk_Read.
  292.  
  293.  
  294.         FK_READLN
  295.         ---------------------------------------------------------------------
  296.         Function fk_Readln( n : byte;
  297.                             up : boolean ):String;
  298.  
  299.         fk_Readln will read in a string of n characters long (max).  If UP
  300.         then the string will be returned in uppercase.  fk_Readln will end
  301.         when the user presses CR or runs out of time.  To control the input
  302.         of strings, see the VARIABLES AND CONSTANTS section.
  303.  
  304.  
  305.         FK_REMOTEBUFFER
  306.         ---------------------------------------------------------------------
  307.         Procedure fk_RemoteBuffer( s : string );
  308.  
  309.         fk_RemoteBuffer will add the string of characters "s" to the 
  310.         inbound user keyboard buffer.  This can be used to add characters 
  311.         as if the user actually typed in those keys.  (For local buffer, see 
  312.         FK_LOCALBUFFER)
  313.  
  314.  
  315.         FK_REMOTEBUFFERCLEAR
  316.         ---------------------------------------------------------------------
  317.         Procedure fk_RemoteBufferClear;
  318.  
  319.         fk_RemoteBufferClear will empty the buffer of stored characters.  
  320.         This function does not empty to fossil buffer.  fk_FlushInputBuffer
  321.         will also empty the stored buffer.
  322.  
  323.  
  324.         FK_REMOTEKEYPRESSED
  325.         ---------------------------------------------------------------------
  326.         Function fk_RemoteKeypressed : boolean;
  327.  
  328.         fk_RemoteKeypressed will return TRUE if there are characters waiting
  329.         in the inbound remote buffer, and FALSE if there are no characters
  330.         waiting.  This only works for the REMOTE keyboard, like the Turbo
  331.         Pascal function KEYPRESSED works for the local keyboard.  To combine
  332.         the two tests (to see if there are any waiting characters anywhere),
  333.         see FK_KEYPRESSED.
  334.  
  335.  
  336.         FK_REMOTEWRITE
  337.         ---------------------------------------------------------------------
  338.         Procedure fk_RemoteWrite( s : string );
  339.  
  340.         fk_RemoteWrite will send the string "s" to the comport.  If it is a
  341.         local connection, this routine will do nothing.  If the remote screen
  342.         has been turned off (see FK_HOST.REMOTESCREEN variable) then the
  343.         output won't go to the remote side either.
  344.  
  345.  
  346.         FK_REMOTEWRITELN
  347.         ---------------------------------------------------------------------
  348.         Procedure fk_RemoteWriteln( s : string;
  349.                                     n : integer );
  350.  
  351.         fk_RemoteWriteln operates exactly like fk_RemoteWrite except will it
  352.         follow by outputting "n" occurrences of CR/LF (next line).  If "n" is
  353.         0, then there will be no CR/LF's appended, and fk_RemoteWriteln will
  354.         operate like exactly fk_RemoteWrite.  ie fk_RemoteWriteln('Tim',0) is
  355.         the same as fk_RemoteWrite('Tim');
  356.  
  357.  
  358.         FK_TEXTBACKGROUND
  359.         ---------------------------------------------------------------------
  360.         Procedure fk_TextBackground( n : byte );
  361.  
  362.         fk_TextBackground will change the background colour attribute, and
  363.         retain the last foreground attribute.
  364.  
  365.  
  366.         FK_TEXTCOLOR / FK_TEXTCOLOUR
  367.         ---------------------------------------------------------------------
  368.         Procedure fk_TextColour( n : byte );
  369.  
  370.         fk_TextColour will set the remote screen attribute and local screen
  371.         attributes.  The n byte is a combined foreground/background/blink
  372.         number which will be used to set all the colour attributes at once
  373.         and operates like the TextAttr:= variable in Turbo Pascal.
  374.  
  375.         To get the combined number, say for yellow (14) on red (4) do
  376.         something like fk_TextColour(14+(4*16));  For each background number,
  377.         the actual n byte will increase by 16.  To add a blink to the yellow
  378.         on red, 128 will be added to the value of n
  379.         fk_TextColour(14+(4*16)+128);
  380.  
  381.         If you are familiar with the TextAttr variable in Turbo Pascal this
  382.         will be an easy to follow function.  If however you wish to set the
  383.         foreground and background attributes separately there are the
  384.         FK_TEXTFOREGROUND and FK_TEXTBACKGROUND functions to use.
  385.  
  386.         ANSI and Avatar codes will be sent when the user has either of the
  387.         respective screen emulations.  If the user is in TTY mode, the colour
  388.         will not change.  The local screen colour will be changed if the user
  389.         is in ANSI or Avatar mode, and in TTY mode if strict colour is off
  390.         (see VARIABLES AND CONSTANTS section).
  391.  
  392.  
  393.         FK_TEXTFOREGROUND
  394.         ---------------------------------------------------------------------
  395.         Procedure fk_TextForeground( n : byte );
  396.  
  397.         fk_TextForeground will change the foreground attribute only, leaving
  398.         the background attribute as is.  If you wish the foreground to blink,
  399.         add 128 to the n byte.
  400.  
  401.  
  402.         FK_TIMELEFT
  403.         ---------------------------------------------------------------------
  404.         Function fk_Timeleft : String;
  405.  
  406.         fk_Timeleft will return the users timeleft in the string variable in
  407.         the format of [-]HH:MM:SS.  The string will be padded with 0's in
  408.         empty spaces, so it will always have a length of 8 characters (unless
  409.         the user has negative time left when the length will be 9).
  410.  
  411.  
  412.         FK_TOGGLEDTR
  413.         ---------------------------------------------------------------------
  414.         Procedure fk_ToggleDTR( Up : Boolean );
  415.  
  416.         fk_ToggleDTR will raise or lower the DTR of the modem.  If UP is TRUE
  417.         then the DTR will be raised, if UP is FALSE the DTR will be lowered.
  418.         Lowering the DTR while there is a carrier will cause the modem to
  419.         hangup on the user (if the modem has been setup to do so).  This is
  420.         the fastest method of logging off a user.  If you drop the DTR for a
  421.         second or two, and then raise it again, the user should be off.
  422.  
  423.  
  424.         FK_WRITE
  425.         ---------------------------------------------------------------------
  426.         Procedure fk_Write( s : string );
  427.  
  428.         fk_Write will send the string "s" to the comport and the local
  429.         screen.  There are several modifier variables that can be used to
  430.         change the output of this procedure; see FK_HOST.REMOTESCREEN and
  431.         FK_HOST.HOSTSCREEN in the variables section for more information.
  432.  
  433.  
  434.         FK_WRITELN
  435.         ---------------------------------------------------------------------
  436.         Procedure fk_Writeln( s : string;
  437.                               n : integer );
  438.  
  439.         fk_Writeln operates exactly like fk_Write except will it follow by
  440.         outputting "n" occurrences of CR/LF (next line).  If "n" is 0, then
  441.         there will be no CR/LF's appended, and fk_Writeln will operate like
  442.         exactly fk_Write.
  443.  
  444.  
  445.         FK_WRITELN_ANSI
  446.         ---------------------------------------------------------------------
  447.         Procedure fk_Writeln_Ansi( s : string;
  448.                                    n : integer );
  449.  
  450.         fk_Writeln_Ansi operates exactly like fk_Writeln except that the
  451.         string "s" can contain ansi sequences.  FKFOSSIL uses it's own built
  452.         in ANSI interpreter to handle the sequences -- this disables most of
  453.         the redundant and dangerous sequences such as Keyboard remapping,
  454.         etc.  If the string is going to have ANSI sequences in it, use this
  455.         procedure.
  456.  
  457.  
  458.         FK_WRITELN_AVATAR
  459.         ---------------------------------------------------------------------
  460.         Procedure fk_Writeln_Avatar( s : string;
  461.                                      n : integer );
  462.  
  463.         fk_Writeln_Avatar operates exactly like fk_Writeln except that the
  464.         string "s" can contain Avatar/0 sequences.  FKFOSSIL uses it's own
  465.         built in avatar interpreter to handle the sequences.
  466.  
  467.  
  468.                              ___________________
  469.  
  470.                              DEFINABLE FUNCTIONS
  471.                              ___________________
  472.  
  473.              See the FKFOSSIL.DOC file before attempting to use any of these
  474.         functions -- the .DOC file has explanations and examples and gives
  475.         more insight to the idea of definable functions.
  476.  
  477.              To setup your "override" functions, you must set them up to
  478.         match exactly the type of function you are replacing.  So if the
  479.         function are you replacing is Function 8_1(ch:Char):Char then your
  480.         function must also be (ch:Char):Char.  The function must also be
  481.         setup as a FAR call.  To do this, you put {$F+} before the function.
  482.         Make sure that you put {$F-} after the function so that it saves you
  483.         memory/space when compiling (no need to setup your entire code to be
  484.         a FAR call).
  485.  
  486.              The replaceable functions are as follows -- the defaults are the
  487.         values that you should return the variable to after you are done with
  488.         your "override".  All of those functions have the same name as the
  489.         initial variable, except read fkp_ instead of fk_ (note the one
  490.         exception to this rule; the input routines).
  491.  
  492.  
  493.         VARIABLE        FUNCTION/PROCEDURE TYPE      INFORMATION / DEFAULT
  494.         --------------------------------------------------------------------
  495.         fk_LocalInput   Function(Ch:Char):Char       Processed when local
  496.                                                      input is received. Char
  497.                                                      is the return character
  498.                                                      -- if you are not doing
  499.                                                      anything with the actual
  500.                                                      character, make sure
  501.                                                      that your function
  502.                                                      returns CH variable.
  503.                                                      (default = fkp_input)
  504.  
  505.         fk_RemoteInput  Function(Ch:Char):Char       Same as fk_LocalInput
  506.                                                      except for remote input.
  507.                                                      (default = fkp_input)
  508.  
  509.         fk_CarrierLoss  Procedure                    Run during any input
  510.                                                      session if the carrier
  511.                                                      is not online. (default
  512.                                                      = fkp_Carrierloss)
  513.  
  514.         fk_Timeout      Procedure                    Run when the user times
  515.                                                      out in any input session
  516.                                                      (doesn't press a key for
  517.                                                      the specified period).
  518.                                                      (default = fkp_Timeout)
  519.  
  520.         fk_NoTimeLeft   Procedure                    Run when the user's time
  521.                                                      run's out in any input
  522.                                                      session. (default =
  523.                                                      fkp_notimeleft)
  524.  
  525.         fk_Close        Procedure                    Run when the fossil
  526.                                                      driver is shut down via
  527.                                                      fk_Deinitfossil.
  528.                                                      (default = fkp_Close)
  529.  
  530.         fk_Open         Procedure                    Run when the fossil
  531.                                                      driver is first started
  532.                                                      via fk_InitFossil[_DF].
  533.                                                      (default = fkp_Open)
  534.  
  535.         fk_MCI          Function(s:string):string    Run when the fk_Display
  536.                                                      functions are displaying
  537.                                                      the files.  Every line
  538.                                                      is passed through and a
  539.                                                      return line is received.
  540.                                                      (default = fkp_MCI)
  541.  
  542.