XTENT(1) XTENT(1) 19 July 1993 NAME xtent - X* resource based specification language X Window System is a trademark of the Massachusetts Institute of Technology. SYNOPSIS xtent [ X-resource-file ] [ -input X-resource-file ] [ -class process-class-name ] OPTIONS X-resource-file Use the contents of X-resource-file as the source for the process. -input X-resource-file Use the contents of X-resource-file as the source for the process. -class process-class-name Use process-class-name as the X class for this process. If no input file is specified, input is assumed to come from standard input. DESCRIPTION xtent is an interpreter that is used to construct X Toolkit (Xt) based applications. The syntax of input programs follows that of the X resource database. See the Xlib manual for a complete description of the X resource syntax. xtent extends the X resource database semantics to include all of the X Toolkit functions for creating and manipulating widgets. See the X Toolkit manual and the xtent reference manual for a complete list of functions. An application developer must have copies of the xtent manual, the X Toolkit manual, and the programmers reference manual for the widget set that is to be used. These are required for looking up the details of the graphics objects and the function calls. This man page, as with the man page for any language processor, primarily gives the options for invoking the processor, in this case an interpreter. The following few paragraphs will give a small bit of detail on what xtent accepts as input. This is not a substitute for the manuals mentioned above. X resource entries resemble C structured data types. The following example will help to demonstrate this point. red: #FF0000 A.B.x: 10 A.B.y: 9 A.B.color: green A*Sensitive: True The first line sets the variable red to the string #FF0000. The next four lines create a B structure within a structure A. The B structure - 1 - Formatted: November 14, 2024 XTENT(1) XTENT(1) 19 July 1993 includes x and y values and a color. The last entry says that under the A structure, any element named Sensitive in any structure will be set to True by default. X resources are at a much higher level of abstraction than C code. The following piece of resource code is a good example: *font: 6x13B This line will result in the font 6x13B being used wherever a font is required, but not explicitly specified. Of course, this sort of parameterization is inherently declarative. The resource mechanism is definitely limited in terms of its use as a programming language. The majority of the X community uses resources only for specifying parameters to widgets, Xt graphics objects. The parameterization, however, has a simple object-oriented style that can be extended for programming. Consider the following line: xtent.allowShellResize: True This line allows the toplevel window (actually shell widget) to be resized when it is required by the application. The sense of the line is to set a variable, allowShellResize, associated with the application xtent to True. Notice that this implies that the string True will be converted to an appropriate type. In object-oriented terms, one could also say, that the allowShellResize procedure associated with the object xtent is called with or sent the message True. This object/message notion can also be written in a style more closely matching that of C++: object.procedure: message (or arguments) Using this syntax and semantics xtent includes all of the procedures required to do Xt level specifications (and then some). XtCreateManagedWidget(), one of the functions used to create widgets, might be used in an application as follows: xtent.Hello.XtCreateManagedWidget: xmPushButton The line causes a widget with the name ``Hello'' to be created. The parent widget is the toplevel widget for the xtent application. The widget class is xmPushButton. The C interface to the X toolkit uses the following function call to create the widget. Hello = XtCreateManagedWidget ("Hello", XmPushButtonWidgetClass, parent, args, arg-count); The C based XtCreateManagedWidget() interface has five parameters: object name, object class, parent object, argument array, and arugment count. Using xtent, the name is given on the left hand or object side of the expression. As widget names are hierarchical, the parent widget name is included in the widget name, and so it does not have to be provided. (The widgets in Xt applications form a tree-like data structure. The toplevel or shell widgets have child widgets, which may also have children. A pushbutton widget, within a form widget, - 2 - Formatted: November 14, 2024 XTENT(1) XTENT(1) 19 July 1993 within the toplevel xtent widget might be specified by the following string, xtent.form.button or .form.button.) In the C version, the args array is for setting widget parameters. The resource parameterization mechanism handles that in xtent. On a function by function basis, xtent can be argued to be conceptually simpler. The one line xtent entry above is all that is required to specify a complete (one widget) Xt program. The same program written directly in C using the X toolkit takes about a page and a half of code. Using X alone takes 5 or 6 pages. Some Xt functions require more than one argument. In those cases, xtent uses a syntax that is similar to that used by C. .image.XtTranslateCoords: (25, 33, x, y) The line above calls the function XtTranslateCoords() for the widget xtent.image. The line above is used to translate widget specific coordinates into display specific coordinates. XtTranslateCoords always takes four arguments. However, some functions, for example XtGetValues take a variable number of arguments. These VARARGS style functions are handled as they are in C. Arguments are simply added by separating the arguments by commas. xtent is best used for manipulating widgets, but it can be used to handle other the arbitrary programming tasks. See the sections of the xtent reference manual describing functions for program control, calculations, string manipulation, and input and output. The usual ``Hello World!'' example can be written as follows: .XtPrint: Hello World! SEE ALSO See X(1) and xrdb(1) for a discussion of X resources. DIAGNOSTICS xtent complains when it cannot open a program or source file, when common syntax errors occur, when object or function names cannot be found, when illegal comparisons are made, or type conversions cannot be accomplished. BUGS Errors that occur within the widget set usually result in segmentation violations. xtent catches these errors, prints that it caught the segmentation violation signal, and exits. All other deadly signals are handled in the same manner. - 3 - Formatted: November 14, 2024