home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
r
/
ril.zip
/
SYNTAX
< prev
Wrap
Text File
|
1992-09-08
|
4KB
|
134 lines
This file is an attempt to quickly describe basic the syntax and
functions primarily used by RIL. It is in no way a complete description
of the RIL/TCL language. RIL is an extension of TCL. This means that pretty
much anything you can do in a TCL program, you can do in an RIL file.
For a complete description of TCL, read the TCL documentation.
Hopefully, armmed with the information here, and the example RIL scripts
provided you will be able to get a feel for the sort of things you can do
with RIL.
I would be very interested in getting feedback from users on things like
- what is good, don't change this ...
- what is wrong, please fix this ...
- what is missing, if it could do this, I could ...
- here is something cute ...
RIL implements a few commands on top of TCL, which allow you to cleanly
specify resource information.
These commands are described below:
Command:
Widget widgetName arg ...
This command specifies a set of resources for the widget given in
"widgetName". Each "arg" is expanded such that every line in the
arg is appended to widgetName. Here is a typical example:
Widget *abc {
wcClassName: XmPushButton
labelString: Push Me
activateCallback: WcTraceCB
}
This would be expanded as:
*abc.wcClassName: XmPushButton
*abc.labelString: Push Me
*abc.activateCallback: WcTraceCB
This is the most used command in RIL, and if it is all you use,
you will simply be using RIL to "clean up" your resource files.
That is a reasonable use for RIL.
It is important to note here, that the block enclosed in {}'s above
is a single argument to the Widget command. The Widget command then
works on each line in each argument. So, you could do this:
set resources {
wcClassName: XmLabel
background: blue
foreground: white
}
Widget *l1 $resources {
labelString: Label 1
}
Widget *l2 $resources {
labelString: Label 2
}
...
The first arg is the set of resources specified by $resources.
These are expanded first, followed by the resources contained in
the next block. Just as in an app-defaults file, identical resources
specified later will "override" the former.
The idea behind this is to define sets of resources that can be
applied as "styles" to widget instances. It seems to me that this
does the same thing as setting resources for a class, but provides
a bit more control over which widgets actually inherit the settings.
Command:
Resources widgetName arg ...
This command does exactly the same thing as Widget. It is intended
that in a future release, the resources specified in Resources commands
will be seperated somewhat from resources supplied in Widget commands.
For example, maybe you would specify the things that typically are hard
coded in Widget commands, and things that you want to end up in an
app-defaults file with Resource commands.
This will allow ril2ad to separate the two sets of resources for you.
Command:
RilSource arg
Read and execute the file given by arg. Two good reasons to do this
might be:
- break UI components into reusable chunks
- different modules for different environments (language)
When invoked by a program called "progname", a file "filename" will
be searched for as follows:
1. current directory/filename
2. $XAPPLRESDIR/filename
3. $PROJECTROOT/lib/X11/app-defaults/filename
4. $PROJECTROOT/lib/X11/app-defaults/progname/filename
I expect to be refining this method soon. Be patient.
Any suggestions would be useful.
Command:
RilParent push|pop [arg]
RIL can keep a "stack" of parental widgets to be applied as each
resource line is written. This command allows you to push a new parent
on the stack or pop one off.
For example:
Widget *main1 {....}
RilParent push *main1
RilSource "foo.ril"
RilParent pop
Widget *main2 {....}
RilParent push *main2
RilSource "foo.ril"
RilParent pop
This would result in all of the widgets created in "foo.ril" having
unique names. The first set would be *main1.whatever, and the
second set would be *main2.whatever. This is useful if you try to
write re-usable ril modules. I do such things to implement standard
dialog buttons or menubars for a set of related applications.
Command:
echo arg arg ...
Echo args to stdout. Useful for debugging.