Little programmer's help for the tclparse
package
Little programmer's help for the tclparse package
This document lists the modules that are used in the programs. For
each module the included objects and their methods are described
briefly. Before that there is a little description of the mechanism
the programs use.
For more detailed information look in the source code.
Table of contents
1. Argument parsing
2. Program stacks
3. The handler
4. Output
5. Module const.h
6. Module display.h
7. Module file.h
8. Module handler.h
9. Module parsing.h
10. Module stack.h
11. Module tclcmd.h
12. Module tkcmd.h
Basics
The program reads single characters from the corresponding file. These
characters are combined to strings with special meaning. Each string
owns a special ID so the program knows how to process the string. The
program knows four types of special strings. They are described in the
following paragraphs.
Atom
The type atom describes a single character. The following table
contains the IDs for atoms.
character
| ID
|
end of file
| EOF
|
tab
| TAB
|
newline
| NEWLINE
|
space
| SPACE
|
$
| DOLLAR
|
;
| SEMICOLON
|
(
| OPEN_PAREN
|
)
| CLOSE_PAREN
|
{
| OPEN_BRACE
|
}
| CLOSE_BRACE
|
"
| QUOTE
|
[
| OPEN_BRACKET
|
]
| CLOSE_BRACKET
|
all other
| NORMAL
|
Symbol
The first difference between a symbol and an atom is
that symbols may consist of more than one character. However this is
only the case for backslash sequences - the symbol then consists of
the backslash and the following character(s).
The second difference is that symbols get special IDs in some
cases. The ID then discribes the meaning of the symbol (for example
the start of an enclosed command body) and not the symbol itself. The
following table lists the normal and special IDs a symbol may own.
symbol
| normal ID
| special ID
|
'\'-sequence
| -
| BSLASH_SUBST
|
(
| OPEN_PAREN
| START_PAREN_GROUP
|
)
| CLOSE_PAREN
| END_PAREN_GROUP
|
{
| OPEN_BRACE
| START_BRACE_GROUP
|
}
| CLOSE_BRACE
| END_BRACE_GROUP
|
"
| QUOTE
| START or END_QUOTE_GROUP
|
[
| OPEN_BRACKET
| START_BRACKET_GROUP
|
]
| CLOSE_BRACKET
| END_BRACKET_GROUP
|
all other
| NORMAL
|
Word
A word is a string between two separators. There are normal
separators like spaces and newlines or special separators like
semicolons and braces that mark the beginning or the end of a group
like a command body. A word may be a special separator, but not a
normal one.
Since words will very often be command or variable names, this
information is stored in the ID. The folllowing table lists these
IDs.
type of string
| ID
|
Tcl command
| TCL_COMMAND
|
Tk command
| TK_COMMAND
|
procedure name
| PROCEDURE
|
Tk widget
| WIDGET
|
Tk image
| IMAGE
|
special symbol
| ID of the symbol
|
all other
| NORMAL
|
Unit
A unit normally is a tcl string between (...), {...}, "..." or
[...]. If there is no such expression the unit adapts the value of a
word. The following IDs are implemented, but not used.
type of group
| ID
|
(...)
| PAREN_GROUP
|
{...}
| BRACE_GROUP
|
"..."
| QUOTE_GROUP
|
[...]
| BRACKET_GROUP
|
all other
| ID of word
|
Parsing
The program reads the commands from the corresponding Tcl program
file. This is done by the procedure ParseFile. If a source
command is encountered, the program tries to open the given file and
to call ParseFile recursively.
To parse a command a special procedure is called, depending on the
type of command. The following table shows what procedure is called
for what type of command.
type of command
| called procedure
|
Tcl command
| ParseTclCommand
|
Tk command
| ParseTkCommand
|
procedure name
| ParseProcedure
|
Tk widget
| ParseTkWidget
|
Tk image
| ParseTkImage
|
The listed procedures continue as described below.
- ParseTclCommand
- For each Tcl command there exists a procedure with the name
ParseTcl...Cmd that is used for parsing the command. The dots
stand for the name of the command. These procedures are found in the
module tclcmd.h and are called by
ParseTclCommand
- ParseTkCommand
- For each Tk command there exists a procedure with the name
ParseTk...Cmd that is used for parsing the command. The dots
stand for the name of the command. These procedures are found in the
module tkcmd.h and are called by
ParseTkCommand
- ParseProcedure
- Parses the command by calling ParseGeneric. The arguments
are read in and it is checked if the number is valid.
- ParseTkWidget
- For each Tk widget there exists a procedure with the name
ParseTk...Widget that is used for parsing the command. The dots
stand for the type of the widget. These procedures are found in the
module tkcmd.h and are called by
ParseTkWidget
- ParseTkImage
- Depending on the type of the image the procedure
ParseTkImageBitmap or ParseTkImagePhoto is called to
parse the command.
The programs use the following stacks:
- parenStack
- is a stack to save open parentheses
- braceStack
- is a stack to save open curly braces
- quoteStack
- is a stack to save open quotes
- bracketStack
- is a stack to save open brackets
- procedureStack
- is a stack to save procedure names so procedure nesting is
possible (not usual in Tcl, but possible)
- commandStack
- is a stack to save command names so command nesting is possible
- normalStack
- is a 'normal' stack where different data is saved
These stacks are of the type CStack. All of them are combined
in the class CTclStack. The declarations are found in the
module stack.h.
The handler is an object that manages commands and
variables in separate environments. Additionally, the handler contains
an environment where the valid options for different commands are
stored. The handler adds, removes or retrieves information from an
environment.
All these environments are of type CList and they have the
names commandList, variableList and
optionsList. The handler himself is of type
CHandler. The declarations are all found in the module handler.h.
The following simple graphic shows that each file contains an own
stack and handler.
CInputFile (processed file)
|
|
|<-- CTclStack <--- CStack (stack for parentheses)
| |
| |- CStack (stack for braces)
| |
| |- CStack (stack for quotes)
| |
| |- CStack (stack for brackets)
| |
| |...
|
|
|<--- CHandler <--- CList (command environment)
|
|- CList (variable environment)
|
|- CList (command options environment)
All output is displayed by the methods of the global object
display. This object is of type CDisplay an is found in
the module display.h.
This module does not include any references to other libraries. It
contains constants used by the programs.
- These integer constants describe the standard length for the
different strings used by the programs.
- const int atomLength = 2
- const int symbolLength = 10
- const int wordLength = 200
- const int unitLength = 700
- const int idLength = 30;
- These character constants are used within the information files to
identify the corresponding sections of the file.
- const char commandInfoID[] = "***COMMANDS***"
- const char variableInfoID[] = "***VARIABLES***"
- These constants describe the different types of strings that are
used by the programs.
- enum dataType { atom, symbol, word, unit };
- This record is used by tclparse to store information about the
arguments that may be specified at program start.
- struct SFlag {
- int commands
- int tclmode
- int procedures
- int statistics
- int variables
- int widgets
- int errors
- int warnings
- char *infoFile
- };
- extern SFlag flag;
- The following character constants are used as search lists by the
programs. Before each search there is a leading and trailing space
added to the search string. Therefore the leading and trailing space
in the following character constants is required.
- The next string contains all (?) standard tcl commands.
- const char tclCommandList[] = " after append array break
case catch cd clock close concat continue eof error eval exec exit
expr fblocked fconfigure file fileevent flush for foreach format gets
glob global history if incr info interp join lappend lindex linsert
list llength load lrange lreplace lsearch lsort open package pid proc
puts pwd read regexp regsub rename return scan seek set socket source
split string subst switch tell time trace unknown unset unsupported0
update uplevel upvar vwait while ";
- The next string contains all (?) standard tk commands.
- const char tkCommandList[] = " . bell bind bindtags button
canvas checkbutton clipboard destroy entry event focus frame grab grid
image label listbox lower menu menubutton message option pack place
radiobutton raise scale scrollbar selection send text tk tkwait
toplevel winfo wm ";
- The next string contains all tcl commands that may be used without
arguments.
- const char nullArgsTcl[] = " break cd concat continue exit
history list pid pwd return update vwait ";
- The next string contains all tk commands that may be used without
arguments.
- const char nullArgsTk[] = " bell destroy focus ";
- This string contains all commands which allow options to be
specified optionally and the command end has to follow these
options.
- const char optionType1[] = " clock_format clock_scan
canvas_arc canvas_bitmap canvas_image canvas_items canvas_line
canvas_oval canvas_polygon canvas_postscript canvas_rectangle
canvas_text canvas_window clipboard_clear grid grid_columnconfigure
grid_rowconfigure image_photo_copy image_photo_put image_photo_read
image_photo_write menu_add pack place selection_clear selection_get
selection_own button canvas checkbutton entry frame image_bitmap
image_photo label listbox menu menubutton message radiobutton scale
scrollbar text text_tag text_window toplevel ";
- This string contains all commands which allow options to be
specified optionally and the command end does not follow these
options.
- const char optionType2[] = " exec glob lsearch lsort regexp
regsub socket subst switch clipboard_append send selection_handle
text_dump text_search ";
- This string contains all commands which allow options to be
specified optionally and the command end may or may not follow these
options.
- const char optionType3[] = " interp_create return ";
This module does not include any references to other libraries. This
module contains the class CDisplay, which defines several
methods for output.
Methods of the class 'CDisplay'
- void Error( char* )
- display an error message consisting of one string
- void Error( char*, char* )
- display an error message consisting of two strings which will be
concatenated
- void Error( char*, char*, char* )
- display an error message consisting of three strings which will be
concatenated
- void Error( char*, char*, char*, char* )
- display an error message consisting of four strings which will be
concatenated
- void Error( char*, char*, char*, char*, char* )
- display an error message consisting of five strings which will be
concatenated
- void ErrorProgramCode( void )
- used to display several lines of the tcl program file to show where an
error has occured (when an error has occured)
- void InternalError( char*, char* )
- used to display a message when an internal error in the program has
occured
- void Message( char* )
- display a message consisting of one string
- void Message( char*, char* )
- display a message consisting of two strings which will be
concatenated
- void Message( char*, char*, char* )
- display a message consisting of three strings which will be
concatenated
- void Message( char*, char*, char*, char* )
- display a message consisting of four strings which will be
concatenated
- void NewProcedure( char *name, char *args )
- used by tclscan when a new procedure was found to display the name and
arguments of the procedure
- void NewVariable( char* )
- used by tclscan when a new global variable was found to display the
name of the variable
- void Procedure( char* )
- used to display the name of the procedure when a proc command was
encountered
- void ProcedureEnd( char* )
- used to display the name of the procedure when the end of a proc
command was encountered
- void TclCommand( char* )
- used to display the name of a tcl command when one was
encountered
- void Title( char* )
- display a framed message consisting of one string
- void Title( char*, char* )
- display a framed message consisting of two strings which will be
concatenated
- void Title( char*, char*, char* )
- display a framed message consisting of three strings which will be
concatenated
- void Title( char*, char*, char*, char* )
- display a framed message consisting of four strings which will be
concatenated
- void Title( char*, char*, char*, char*, char* )
- display a framed message consisting of five strings which will be
concatenated
- void TkCommand( char* )
- used to display the name of a tk command when one was
encountered
- void Variable( char* )
- used to display the name of a variable when one was
encountered
- void Warning( char* )
- display a warning message consisting of one string
- void Warning( char*, char* )
- display a warning message consisting of two strings which will be
concatenated
- void Warning( char*, char*, char* )
- display a warning message consisting of three strings which will be
concatenated
- void Widget( char* )
- used to display the name of a widget when one was
encountered
- extern CDisplay display
- the global display object
- This module requires the following libraries:
- #include <fstream.h>
- #include "stack.h"
- #include "handler.h"
- The module contains the class CInputFile. For each tcl
program file that is parsed or scanned, an object of the type
CInputFile is created. It includes elementary methods for file
operations like opening and closing a file and for reading input from
a file. It contains an own stack and an environment where data about
commands and variables is stored.
Methods of the class 'CInputFile'
- void Close( void )
- close the file the object is associated with
- void DisableBraceFlag( void )
- set the flag which is used to signal that a braced group is
processed to 0
- void DisableScanFlag( void )
- set the flag which is used to signal that the program is scanning
to 0
- void DumpStacks( void )
- show the contents of all stacks (used for debugging purposes)
- void EnableBraceFlag( void )
- set the flag which is used to signal that a braced group is
processed to 1
- void EnableScanFlag( void )
- set the flag which is used to signal that the program is scanning
to 1
- int Eof( void )
- returns 1 if the end of the file was reached, 0 if not
- char *GetChar( void )
- reads a character from the file and returns it
- streampos GetErrorOffset( void )
- returns the offset of the position from where the output of the
source code should be started when an error has occured
- char *GetLine( void )
- reads a line from the file and returns it
- char *Name( void )
- returns the name of the file the object is associated with
- int Open( void )
- opens the file the object is associated with (the object
should already be associated with a file)
- int Open( char *fileName )
- associates the file fileName with the object and opens
it
- void Restore( void )
- restore the data that was saved with the last call of
Save()
- void Save( void )
- save the current file information
- void Seek( streampos offset )
- set the file pointer to a new offset
- void SetErrorOffset( void )
- used to adapt the offset that is used for the output of source
code when an error has occured
- void SetName( char *fileName )
- sets the name for the file the object is associated with to
fileName
- streampos Tell( void )
- returns the current position of the file pointer
- extern CInputFile *actualFile
- the global file object that points to the file object that has
the current input focus
- This module requires the following libraries:
- #include <iostream.h>
- #include <fstream.h>
- The module contains the following classes:
- template<class TYPE> class CList
- is a template class for chained lists in two directions
- class CTclDataType
- is a class that describes the qualities that commands and
variables have in common
- class CCommand : public CTclDataType
- is a class that describes the qualities of a tcl command, such as
procedures, images and widgets. Some methods are only valid for one
type of command
- class CVariable : public CTclDataType
- is a class that describes the qualities of a variable
- class CHandler
- is a class that contains methods for administrating the
environments for commands and variables
- TYPE *First( void )
- returns a pointer to the first element in the list
- TYPE *Next( void )
- returns a pointer to the next element in the list, NULL if the end
of the list was reached
- void Insert( TYPE &element )
- is used to insert a new element to the end of the list
- int Remove( TYPE &element )
- removes all elements of the list that match the argument. For this
method an overloaded '=='-operator is required for the TYPE-class.
- TYPE *Get( TYPE &element )
- returns a pointer to the first element in the list that matches
the argument. For this method an overloaded '=='-operator is required
for the TYPE-class.
- int Contains( TYPE &element )
- returns 1 if the list contains an element that matches the argument,
0 if ist does not. For this method an overloaded '=='-operator is
required for the TYPE-class.
- int IsEmpty( void )
- returns 1 if the list contains no elements, 0 is it contains at
least one element
- CList &operator=( CList &list )
- overloaded operator for assigning the contents of a list object to
another list object
- int Calls( void )
- returns the number of times the command or variable was used
- char *Name( void )
- returns the name of the command or variable
- void IncCalls( void )
- increases the number of times the command or variable was used
- void SetCalls( int newCalls )
- sets the number of times the command or variable was used to
newCalls
- void SetName( char *newName )
- sets the name of the command or variable to newName
- int operator==( CTclDataType &dataType )
- overloaded operator for comparing
CTclDataType-objects. For comparison only the names are
used.
- CTclDataType &operator=( CTclDataType &dataType )
- overloaded operator for assigning the contents of a
CTclDataType object to another
CTclDataType-object
- char *CommandID( void )
- returns a string that stands for the type of command (currently
PROCEDURE, IMAGE or WIDGET)
- char *List( void )
- returns the argument list for procedures or the image type
(BITMAP or PHOTO) for images
- int Max( void )
- returns the maximum number of arguments allowed for the
procedure. If the number may be infinite then -1 is returned
- int Min( void )
- returns the minimum number of arguments allowed for the
procedure
- void SetCommandID( char *newCommandID )
- sets the type of command to newCommandID
- void SetList( char *newList )
- for procedures sets the list of arguments to newList, for
images the type of image
- void SetMax( int newMax )
- sets the maximum number of arguments allowed for the procedure to
newMax
- void SetMin( int newMin )
- sets the minimum number of arguments allowed for the procedure to
newMin
- int operator==( CCommand &command )
- overloaded operator for comparing CCommand-objects. For
comparison only the names are used
- CCommand &operator=( CCommand &command )
- overloaded operator for assigning the contents of a
CCommand-object to another CCommand-object
- char *Environment( void )
- returns a string that represents the current environment in that
the program is working
- void SetEnvironment( char *newEnvironment )
- sets the actual environment to newEnvironment
- void SetStatus( int status )
- sets the initialization status of the variable to
status. One means the variable was initialized, zero that it
was not initialized
- int Status( void )
- returns the status of initialization of the variable
- int operator==( CVariable &variable)
- overloaded operator for comparing CVariable-objects. For
comparison the names and the environment strings are used
- CVariable &operator=( CVariable &variable )
- overloaded operator for assigning the contents of a
CVariable-object to another CVariable-object
- void AddCommand( char *name, char
*commandID, char *list, int min=0, int max=0, int calls=0 )
- adds the command name of type commandID to the
command environment. For procedures the argument list
specifies the list of arguments, min the minimum number of
arguments allowed and max the maximum number of arguments
allowed. For images the argument list describes the type
of image. The argument calls describes the number of times a
command was used in the tcl program file and is valid for all command
types
- void AddImage( char *name, char
*type, int calls=0 )
- adds the image name of type type to the environment
for commands
- void AddOptionList( char *name, char *list )
- adds list to the special environment for valid options of
commands. list contains all valid options for the command
name
- void AddProcedure( char *name,
char *arguments, int min=0, int max=0, int calls=0 )
- adds the procedure name with argument list arguments
to the environment for commands. The argument min describes the
minimum number of arguments allowed and max the maximum number
of arguments allowed. The argument calls describes the number
of times the procedure was used in the tcl program file
- int AddVariable( char *name, char
*environment, int status=0, int calls=0 )
- adds the variable name in environment to the
environment for variables. status describes
the status of
initialization for the variable
- void AddWidget( char *name, char
*type, int calls=0 )
- adds the widget name of type type to the environment
for commands
- int IsArray( char *name, char *environment )
- returns 1 if name is an array in environment, 0 if
not
- int IsCommand( char *name )
- returns 1 if name is a command (procedure,
image or widget), 0 if not
- int IsGlobal( char *name )
- returns 1 if name is the name of a global variable, 0 if
not
- int IsImage( char *name )
- returns 1 if name is the name of an image, 0 if not
- int IsOption( char *option, char
*command )
- returns 1 if option is a valid option for the command
command
- int IsProcedure( char *name )
- returns 1 if name is the name of a procedure, 0 if not
- int IsVariable( char *name, char *environment )
- returns 1 if name is the name of a variable in
environment, 0 if not
- int IsWidget( char *name )
- returns 1 if name is the name of a widget, 0 if not
- CCommand *GetCommand( char *name )
- returns a pointer to a CCommand-object representing the
command name. If name is not a command, NULL is
returned
- int GetOptionCount( char *option, char *command )
- returns the number of arguments expected for the option
option of command command
- CCommand *GetOptionList( char *name )
- returns a string containing the valid options for the command
name
- CVariable *GetVariable( char
*name, char *environment )
- returns a pointer to a CVariable-object representing the
variablename in environment. If name is not a
variable, NULL is returned
- char *NextEnvironment( char
*envString )
- returns a string that represents the environment that is one level
higher than the one represented by envString. If the highest
environment is given, then the highest environment is returned
- char *ParentWidget( char *name )
- returns the name of the parent widget of the widget
name. If name equals to '.', then '.' is returned
- int RemoveCommand( char *name )
- removes the command name from the environment for commands
and returns 1 if the removal was successfull, 0 if not
- int RemoveVariable( char *name, char *environment )
- removes the variable name in environment from the
environment for variables and returns 1 if the removal was
successfull, 0 if not
- int Write( char *fileName )
- writes the contents of the command and variable environment to
the information file fileName
- CHandler &operator=( CHandler &handler )
- overloaded operator for assigning the contents of a
CHandler-object to another CHandler-object
- This module requires the following libraries:
- #include "const.h"
- #include "handler.h"
Methods in the module parsing.h
- char *Actual( dataType )
- returns the actual atom, symbol, word or
unit
- char *ActualID( dataType )
- returns the identifier for the actual atom, symbol,
word or unit
- void AddCommand( CCommand &command )
- adds the command specified by the object command to the
environment for commands
- void AddCommand( char *name, char
*commandID, char *list, int min=0, int max=0, int calls=0 )
- void AddImage( char*, char*, int
calls=0 )
- int AddVariable( CVariable &variable )
- adds the variable specified by the object variable to the
environment for variables
- int AddVariable( char*, char*,
int status=0, int calls=0 )
- void AddWidget( char*, char*, int
calls=0 )
- char *Environment( void )
- returns a string that represents the current environment in that
the program is working
- char *GetAtom( void )
- reads a string of type atom from the tcl program file and
returns it
- CCommand *GetCommand( char *name
)
- char *GetSymbol( void )
- reads a string of type symbol from the tcl program file and
returns it
- CVariable *GetVariable( char
*name, char *environment )
- char *GetWord( void )
- reads a string of type word from the tcl program file and
returns it
- char *GetUnit( void )
- reads a string of type unit from the tcl program file and
returns it
- void HandleError( void )
- is called whenever a serious error was encountered to read to the
end of the line, so that the next command may be processed
- int IsArray( char *name )
- returns 1 if name is an array in the current environment, 0 if not
- intIsArray( char *name, char
*environment )
- int IsCommand( char *name )
- int IsDigit( char ch )
- returns 1 if ch is a decimal digit, 0 if not
- int IsElementOf( char *element, char *set )
- returns 1 if element is an element of the 'list'
set, 0 if not
- int IsGlobal( char *name )
- int IsGroupActive( char *ch )
- returns 1 if a group specified by ch is active, 0 if
not. If ch equals to ' ', 1 is returned if any group is active
and 0 if not. Other valid options for ch are the characters
'(', ')', '{', '}', '"', '[' and ']'.
- int IsGroupEnd( void )
- returns 1 if the last atom read marks the end of a group,
0 if not
- int IsGroupStart( void )
- returns 1 if the last symbol read marks the beginning of a
group, 0 if not
- int IsHexDigit( char ch )
- returns 1 if ch is a hexadecimal digit, 0 if not
- int IsImage( char *name )
- int IsLastArg( void )
- returns 1 if the last expression read was the last argument of the
command that is processed, 0 if not
- int IsLevel( char *string )
- returns 1 if string is a valid level argument for
the uplevel or upvar command, 0 if not
- int IsLoopActive( void )
- returns 1 if the command that is processed equals to for,
foreach or while, and 0 if not
- int IsNumber( char *ch )
- returns 1 if ch is a positive number, 0 if not
- int IsOctalDigit( char ch )
- returns 1 if ch is an octal digit, 0 if not
- int IsOption( char *option, char
*command )
- int IsProcedure( char *name )
- int IsTclCommand( char *name )
- returns 1 if name is the name of a tcl command, 0 if not
- int IsTkCommand( char *name )
- returns 1 if name is the name of a tk command, 0 if not
- int IsVariable( char *name )
- returns 1 if name is the name of a variable in the current
environment, 0 if not
- int IsVariable( char *name, char
*environment )
- int IsWidget( char *name )
- int IsWordEnd( void )
- returns 1 if the last atom read is the last of a
word, 0 if not. Used by the method GetWord
- char *Last( dataType )
- returns the last atom, symbol, word or
unit
- char *LastID( dataType )
- returns the identifier for the last atom, symbol,
word or unit
- int LoadInfo( char *fileName )
- loads data from the information file fileName into the
command and variable environments. Returns 1 if successfull, 0 if
not
- char *Next( dataType )
- returns the next atom, symbol, word or
unit
- char *NextEnvironment( char
*envString )
- char *NextID( dataType )
- returns the identifier for the next atom, symbol,
word or unit
- char *ParentWidget( char *name
)
- CCommand *ParseArgumentList( void )
- parses the argument list of a proc command. The argument list and
the minimum and maximum number of arguments allowed are stored in a
CCommand-object and a pointer to this object is returned
- char *ParseBraceGroup( void )
- parses an expression in curly braces and returns the contents
- char *ParseBracketGroup( void )
- parses an expression in brackets and returns the contents
- int ParseCgetOption( char *commandID )
- parses the option list of the tk cget command for the widget
represented by commandID. Returns 1 if successfull, 0 if not
- int ParseCommandEnd( void )
- returns 1 if there are no more arguments for the current
command. If there are any arguments left they are read in and 0 is
returned
- void ParseComment( void )
- parses a comment
- int ParseConfigureOptions( char *commandID )
- parses the option list of the tk configure command for the widget
represented by commandID. Returns 1 if successfull, 0 if not
- char *ParseDollar( void )
- parses a variable substitution after '$'-character. Returns the
name of the variable and checks if the variable is known in the
variable environment. If not, an error message will be generated
- void ParseFile( char *fileName )
- parses the tcl program file fileName
- void ParseGeneric( int min, int max )
- reads all arguments of a command and checks if the number read
is equal or between min and max. If the number is not
valid an error message is generated
- int ParseOptionalUnit( void )
- reads the next unit and returns 1. If the current command
contains no more units nothing is read and 0 returned
- int ParseOptionalWord( void )
- reads the next word and returns 1. If the current command
contains no more words nothing is read and 0 returned
- int ParseOptions( char *commandID )
- parses the options of the command represented by
commandID. Returns 0 if a serius error occured, 1 if not
- char *ParseParenGroup( void )
- parses an expression in parentheses and returns the contents
- void ParseProcedure( char *name )
- is called whenever the name of a procedure was encountered as
command to parse the arguments of the procedure. name specifies
the name of the procedure, so that the information about the arguments
may be retrieved
- char *ParseQuoteGroup( void )
- parses an expression in quotes and returns the contents
- int ParseScript( void )
- parses a command body and returns 0 if there was a serious error,
1 if not
- void ParseTclCommand( char *command )
- is called whenever a tcl command was encountered to parse the
arguments of the command. command specifies the name of the
command, so that the corresponding method for parsing this command may
be called
- void ParseTkCommand( char *command )
- is called whenever a tk command was encountered to parse the
arguments of the command. command specifies the name of the
command, so that the corresponding method for parsing this command may
be called
- void ParseTkWidget( char name* )
- is called whenever the name of a widget was encountered as
command to parse the arguments of the widget. name specifies
the name of the widget, so that the information about the type
may be retrieved
- void ParseTkWidgetCmd( char *command )
- is called from ParseTkCommand when command is a
command that creates a widget. The command is parsed and the widget is
added to the command environment
- int ParseUnit( void )
- reads the next unit and returns 1. If the current command
contains no more units an error message 'argument expected' is
generated and 0 returned
- int ParseUnit( char *name )
- reads the next unit and returns 1. If the current command
contains no more units an error message 'argument $name
expected' is generated and 0 returned
- void ParseUnknownCommand( char *name )
- parses an unknown command and displays an error message
- int ParseWidget( void )
- reads the next unit and returns 1. If unit is not a
known widget, an error message 'unknown widget' is displayed. If no
unit remains within the current command an error message
'widget expected' is displayed and 0 returned
- int ParseWord( void )
- reads the next word and returns 1. If the current command
contains no more words an error message 'argument expected' is
generated and 0 returned
- int RemoveCommand( char *name )
- removes the command name from the command
environment. Returns 1 if successfull, 0 if the command did not
exist
- int RemoveImage( char *name )
- removes the image name from the command
environment. Returns 1 if successfull, 0 if the image did not exist
- int RemoveProcedure( char *name )
- removes the procedure name from the command
environment. Returns 1 if successfull, 0 if the procedure did not
exist
- int RemoveVariable( CVariable &variable )
- removes the variable specified by variable from the
variable environment. Returns 1 if successfull, 0 if the variable did
not exist
- int RemoveVariable( char *name, char *environment )
- removes the variable name in environment from the
variable environment. Returns 1 if successfull, 0 if the variable did
not exist
- int RemoveWidget( char *name )
- removes the widget name from the command
environment. Returns 1 if successfull, 0 if the widget did not
exist
- void SaveInfo( char *fileName )
- saves the current data from the command and variable environment
to the information file fileName
- int ScanFile( char *fileName )
- scans the tcl program file fileName
This module does not include any references to other libraries.
The module contains the following classes:
- class CStack
- is a class for a stack with strings
- class CTclStack
- is a class that contains several stacks the programs
require
- char *Concat( char *separator )
- concatenates the elements of the stack separated by
separator and returns the resulting string
- int Contains( char *string )
- returns 1 if string is an element of the stack, 0 if not
- char *First( void )
- returns a pointer to the first element of the stack
- char *Next( void )
- returns a pointer to the next element of the stack, NULL if the
end of the stack was reached
- char *Pop( void )
- removes the element on top of the stack and returns it. If the
stack is empty NULL is returned
- void Push( char *string )
- adds the element string to the top of the stack
- char *Top( void )
- returns the element that is on top of the stack. If the stack is
empty, the empty string "" is returned
- CStack &operator=( CStack &stack )
- overloaded operator for assigning the contents of a
CStack-object to another CStack-object
- char *Concat( stackType, char *separator )
- concatenates the elements of the stack specified by
stackType separated by separator and returns the
resulting string. Valid options for stackType are
parens, braces, quotes, brackets,
procedures, commands and normal
- int Contains( stackType, char *string )
- returns 1 if string is an element of the stack specified by
stackType, 0 if not
- char *Pop( stackType )
- removes the element on top of the stack specified by
stackType and returns it. If the stack is empty NULL is
returned
- void Push( stackType, char *string )
- adds the element string to the top of the stack specified
by stackType
- char *Top( stackType )
- returns the element that is on top of the stack specified by
stackType. If the stack is empty, the empty string "" is
returned
- CTclStack &operator=( CTclStack &stack )
- overloaded operator for assigning the contents of a
CTclStack-object to another CTclStack-object
Like described in the section about argument parsing there exists a procedure
for each Tcl command that is used to parse that specific command. This
module contains all these procedures.
void ParseTclAfterCmd( void )
void ParseTclAppendCmd( void )
void ParseTclArrayCmd( void )
void ParseTclBreakCmd( void )
void ParseTclCaseCmd( void )
void ParseTclCatchCmd( void )
void ParseTclCdCmd( void )
void ParseTclClockCmd( void )
void ParseTclCloseCmd( void )
void ParseTclConcatCmd( void )
void ParseTclContinueCmd( void )
void ParseTclEofCmd( void )
void ParseTclErrorCmd( void )
void ParseTclEvalCmd( void )
void ParseTclExecCmd( void )
void ParseTclExitCmd( void )
void ParseTclExprCmd( void )
void ParseTclFblockedCmd( void )
void ParseTclFconfigureCmd( void )
void ParseTclFileCmd( void )
void ParseTclFileeventCmd( void )
void ParseTclFlushCmd( void )
void ParseTclForCmd( void )
void ParseTclForeachCmd( void )
void ParseTclFormatCmd( void )
void ParseTclGetsCmd( void )
void ParseTclGlobCmd( void )
void ParseTclGlobalCmd( void )
void ParseTclHistoryCmd( void )
void ParseTclIfCmd( void )
void ParseTclIncrCmd( void )
void ParseTclInfoCmd( void )
void ParseTclInterpCmd( void )
void ParseTclJoinCmd( void )
void ParseTclLappendCmd( void )
void ParseTclLindexCmd( void )
void ParseTclLinsertCmd( void )
void ParseTclListCmd( void )
void ParseTclLlengthCmd( void )
void ParseTclLoadCmd( void )
void ParseTclLrangeCmd( void )
void ParseTclLreplaceCmd( void )
void ParseTclLsearchCmd( void )
void ParseTclLsortCmd( void )
void ParseTclOpenCmd( void )
void ParseTclPackageCmd( void )
void ParseTclPidCmd( void )
void ParseTclProcCmd( void )
void ParseTclPutsCmd( void )
void ParseTclPwdCmd( void )
void ParseTclReadCmd( void )
void ParseTclRegexpCmd( void )
void ParseTclRegsubCmd( void )
void ParseTclRenameCmd( void )
void ParseTclReturnCmd( void )
void ParseTclScanCmd( void )
void ParseTclSeekCmd( void )
void ParseTclSetCmd( void )
void ParseTclSocketCmd( void )
void ParseTclSourceCmd( void )
void ParseTclSplitCmd( void )
void ParseTclStringCmd( void )
void ParseTclSubstCmd( void )
void ParseTclSwitchCmd( void )
void ParseTclTellCmd( void )
void ParseTclTimeCmd( void )
void ParseTclTraceCmd( void )
void ParseTclUnknownCmd( void )
void ParseTclUnsetCmd( void )
void ParseTclUnsupported0Cmd( void )
void ParseTclUpdateCmd( void )
void ParseTclUplevelCmd( void )
void ParseTclUpvarCmd( void )
void ParseTclVwaitCmd( void )
void ParseTclWhileCmd( void )
Like described in the section about argument parsing there exists a procedure
for each Tk command that is used to parse that specific command. This
module contains all these procedures and some helpers.
int ParseBindSequence( void )
int ParseBindScript( void )
int ParseVirtualEvent( void )
void ParseTkBellCmd( void )
void ParseTkBindCmd( void )
void ParseTkBindtagsCmd( void )
void ParseTkBitmapImage( void )
void ParseTkButtonWidget( void )
void ParseTkCanvasWidget( void )
void ParseTkCheckbuttonWidget( void )
void ParseTkClipboardCmd( void )
void ParseTkDestroyCmd( void )
void ParseTkEntryWidget( void )
void ParseTkEventCmd( void )
void ParseTkFocusCmd( void )
void ParseTkFrameWidget( void )
void ParseTkGrabCmd( void )
void ParseTkGridCmd( void )
void ParseTkImage( char *name )
void ParseTkImageCmd( void )
void ParseTkLabelWidget( void )
void ParseTkListboxWidget( void )
void ParseTkLowerCmd( void )
void ParseTkMenuWidget( void )
void ParseTkMenubuttonWidget( void )
void ParseTkMessageWidget( void )
void ParseTkOptionCmd( void )
void ParseTkPackCmd( void )
void ParseTkPhotoImage( void )
void ParseTkPlaceCmd( void )
void ParseTkRadiobuttonWidget( void )
void ParseTkRaiseCmd( void )
void ParseTkScaleWidget( void )
void ParseTkScrollbarWidget( void )
void ParseTkSelectionCmd( void )
void ParseTkSendCmd( void )
void ParseTkTextWidget( void )
void ParseTkTkCmd( void )
void ParseTkTkwaitCmd( void )
void ParseTkToplevelWidget( void )
void ParseTkWinfoCmd( void )
void ParseTkWmCmd( void )