Token/Text Input
Usage Documentation

This is usage documentation for a Tcl extension intended to input a file which consists of tokens and text. The extension is object oriented in the same way Tk is. That means you must create an object (or widget) before you can take advantage of its functionality. The procedures involved with creating and destroying objects are:

sbf::intoke open
sbf::intoke close
sbf::intoke parameters

The above procedures are placed in the sbf namespace as the extension is loaded. Each object is created with an action family of object procedures with an arbitrary name. The actions in this family are:

<object_name> advanceToken
<object_name> advanceChar
<object_name> String
<object_name> Token
<object_name> NextChar
<object_name> LineNumber

The extension is implemented in C whose code. Versions for three compilers have been automatically generated: gcc, Borland, and Microsoft. The Borland version is for use with the IDE and requires this DEF file. The Microsoft version is for use with this makefile. The gcc/Unix version is also available in a more readable annotated html form.

This usage documentation and its source document are copyrighted 1999 by J Adrian Zimmer. All rights are reserved. Please refer back to this web page at its original location whenever you wish to look at it.

General Discussion

The sbf::intoke extension is for the input of files that are mixtures of text and tokens. You name the tokens when opening the file and creating an input object. The <object_name> advanceToken action advances input to the first named token to appear next in the file and, then, <object_name> String contains the text that was advanced over to get to the token and <object_name> Token contains the token. The entire file can be read with successive executions of <object_name> advanceChar. After the final read, <object_name> Token will be an empty string and <object_name> String will containing anything appearing in the file after the final token.

For cases where another style of input must be mixed with the expected token-by-token input, there are object actions for viewing the next character in the file and for advancing the file character by character.

This extension was created to speed up the Tcl script I use to create gcc, Borland, and Microsoft versions of the C code used in Tcl extensions. I call this script my Metamark translator. Different plugins for this translator cause the desired variations in my C code.

Individual Class Actions

sbf::intoke open NEW_OBJECT_NAME FILE_NAME TOKENS
sbf::intoke close OBJECT_NAME
sbf::intoke parameters BUFFER_SIZE TOKEN_SIZE

Individual Object Actions

<object_name> advanceToken
<object_name> advanceChar
<object_name> Token
<object_name> String
<object_name> NextChar
<object_name> LineNumber
Related to Tcl/Tk for Programmers
Jul 08, 2000