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   
Text File  |  1992-09-08  |  4KB  |  134 lines

  1.  
  2. This file is an attempt to quickly describe basic the syntax and 
  3. functions primarily used by RIL.  It is in no way a complete description
  4. of the RIL/TCL language.  RIL is an extension of TCL. This means that pretty 
  5. much anything you can do in a TCL program, you can do in an RIL file.  
  6. For a complete description of TCL, read the TCL documentation.
  7.  
  8. Hopefully, armmed with the information here, and the example RIL scripts
  9. provided you will be able to get a feel for the sort of things you can do
  10. with RIL.
  11.  
  12. I would be very interested in getting feedback from users on things like
  13.     - what is good, don't change this ...
  14.     - what is wrong, please fix this ...
  15.     - what is missing, if it could do this, I could ...
  16.     - here is something cute ...
  17.  
  18. RIL implements a few commands on top of TCL, which allow you to cleanly
  19. specify resource information.
  20. These commands are described below:
  21.  
  22. Command: 
  23.     Widget    widgetName arg ...
  24.  
  25.     This command specifies a set of resources for the widget given in
  26.     "widgetName". Each "arg" is expanded such that every line in the
  27.     arg is appended to widgetName. Here is a typical example:
  28.  
  29.     Widget *abc {
  30.         wcClassName: XmPushButton        
  31.         labelString: Push Me
  32.         activateCallback: WcTraceCB
  33.     }
  34.  
  35.     This would be expanded as:
  36.  
  37.     *abc.wcClassName: XmPushButton
  38.     *abc.labelString: Push Me
  39.     *abc.activateCallback: WcTraceCB
  40.  
  41.     This is the most used command in RIL, and if it is all you use,
  42.     you will simply be using RIL to "clean up" your resource files.
  43.     That is a reasonable use for RIL.
  44.  
  45.     It is important to note here, that the block enclosed in {}'s above
  46.     is a single argument to the Widget command.  The Widget command then
  47.     works on each line in each argument.  So, you could do this:
  48.  
  49.     set resources {
  50.         wcClassName: XmLabel
  51.         background: blue
  52.         foreground: white
  53.        }
  54.  
  55.     Widget *l1 $resources {
  56.         labelString: Label 1
  57.     }
  58.  
  59.     Widget *l2 $resources {
  60.         labelString: Label 2
  61.     }
  62.     ...
  63.  
  64.     The first arg is the set of resources specified by $resources.
  65.     These are expanded first, followed by the resources contained in
  66.     the next block.  Just as in an app-defaults file, identical resources
  67.     specified later will "override" the former.
  68.  
  69.     The idea behind this is to define sets of resources that can be 
  70.     applied as "styles" to widget instances.  It seems to me that this
  71.     does the same thing as setting resources for a class, but provides
  72.     a bit more control over which widgets actually inherit the settings.
  73.  
  74.  
  75. Command:    
  76.     Resources widgetName arg ...
  77.  
  78.     This command does exactly the same thing as Widget.  It is intended
  79.     that in a future release, the resources specified in Resources commands
  80.     will be seperated somewhat from resources supplied in Widget commands.
  81.     For example, maybe you would specify the things that typically are hard 
  82.     coded in Widget commands, and things that you want to end up in an 
  83.     app-defaults file with Resource commands.
  84.     This will allow ril2ad to separate the two sets of resources for you.
  85.  
  86. Command:
  87.     RilSource arg
  88.     
  89.     Read and execute the file given by arg.  Two good reasons to do this
  90.     might be:
  91.         - break UI components into reusable chunks
  92.         - different modules for different environments (language)
  93.  
  94.     When invoked by a program called "progname", a file "filename" will 
  95.     be searched for as follows:
  96.         1. current directory/filename
  97.         2. $XAPPLRESDIR/filename
  98.         3. $PROJECTROOT/lib/X11/app-defaults/filename
  99.         4. $PROJECTROOT/lib/X11/app-defaults/progname/filename
  100.  
  101.     I expect to be refining this method soon. Be patient.
  102.     Any suggestions would be useful.
  103.  
  104.  
  105. Command: 
  106.     RilParent push|pop [arg]
  107.  
  108.     RIL can keep a "stack" of parental widgets to be applied as each
  109.     resource line is written. This command allows you to push a new parent
  110.     on the stack or pop one off.
  111.  
  112.     For example:
  113.     Widget *main1 {....}
  114.     RilParent push *main1
  115.     RilSource "foo.ril"
  116.     RilParent pop
  117.  
  118.     Widget *main2 {....}
  119.     RilParent push *main2
  120.     RilSource "foo.ril"
  121.     RilParent pop
  122.  
  123.     This would result in all of the widgets created in "foo.ril" having
  124.     unique names. The first set would be *main1.whatever, and the
  125.     second set would be *main2.whatever.  This is useful if you try to
  126.     write re-usable ril modules.  I do such things to implement standard
  127.     dialog buttons or menubars for a set of related applications.
  128.  
  129.  
  130. Command:
  131.     echo arg arg ...
  132.     
  133.     Echo args to stdout.  Useful for debugging.
  134.