wlc

Section: Miscellaneous Library Functions (3X)
Updated: Cornell University Widget Set
Index Return to Main Contents
 

NAME

wlc - A Widget Layout Compiler  

OVERVIEW

 
Usage: wlc name, or wlc name.wl

The wlc widget layout compiler parses a description language with a .wl extension and outputs three files:

name.wc - a compiled widget layout description
name.cl - a list of widget classes encountered in name.wl.
name.lw - a list of .wl files encountered in name.wl.

name.wc is the file that is referenced by the XcuWlm XtNfile resource. There are three reasons for having compilation be a separate process. Since compilation is rapid, speed is the least important reason. Probably more important is the size of client programs, since this isolates the largish routines generated by lex and yacc. The primary reason, however, is to enable an automatic mechanism for linking the required widgets with the client program. The name.cl and name.lw files are part of that mechanism.

Client programs are required to have a make_tag_class_list() procedure which creates a list of widget class pairs. One member of the pair is the widget class name string as it appears in the description language, and the other member of the pair is the widget class pointer. To make this procedure "by hand", follow this template:

#include <Xcu/WlmP.h>
#include <XidName.h> /* One for each widget (substitute for id) */

void make_tag_class_list(wlm)
XcuWlmWidget wlm ;
{
TAG_CLASS_ENTRY (wlm, "Name", nameWidgetClass) ; /* One for each widget */
}

For each widget to be linked into the client, substitute the appropriate widget name. E.g., "Name" and "name" could be "XcuLabel" and "xcuLabel".

The following Makefile fragment, however, shows how it can be created automatically when a significant change has been made to the layout description:

WLDL=layout.wl
WLDLI=layout1 layout2
INCL_PATH=/usr/local/include
CAT=/bin/cat
CLIENT=main

$(CLIENT).o : $(CLIENT).c $(CLIENT).wh
       $(CC) -c $(CFLAGS) $(CLIENT).c

$(CLIENT).wh : $(CLIENT).wb
       wlm_incl_make `$(CAT) $(CLIENT).wb` > $@

$(CLIENT).nc : $(WLDL)
       wlm_update_class $(CLIENT) $?

$(CLIENT).wf : $(CLIENT).nc

$(CLIENT).wb : $(CLIENT).wf
       wlm_doupdate $(CLIENT)

$(WLDL) : $(WLDLI)
       touch $@

The logic is as follows:

main.c depends on main.wh, which is an include file that contains make_tag_class_list().

main.wh depends on main.wb, which is a list of widgets

main.wb depends on a dummy file, main.wf, which is only touched when there are new widget names in the layout description

main.wb is created from main.nc by wlm_doupdate

main.nc is created by wlm_update_class, which invokes the compiler on the layout description.

If only cosmetic changes are made to the layout description, "make" will not update the client. If, however, new widgets are added, then a new include file will be generated, which will then force a recompile and relink.

 

WARNINGS

 
Some widget sets (e.g., HP) violate intrinsics naming conventions, making it difficult to automatically generate a good include file. wlm_incl_make has been fudged to handle HP widgets, but future problems could occur if future non-compliant widgets are used.

 

AUTHOR

 
Gene Dykes, gwd@freedom.graphics.cornell.edu
Program of Computer Graphics, Cornell University


 

Index

NAME
OVERVIEW
WARNINGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 23:33:04 GMT, February 06, 2023