Specifications

Athena Widget Set libXaw 1.0.7
The AsciiSrc can be either of twotypes: XawAsciiFile or XawAsciiString.
AsciiSrc objects of type XawAsciiFile read the text from a file and store it into an internal buffer.
This buffer may then be modified, provided the text widget is in the correct edit mode, just as if it
were a source of type XawAsciiString.UnlikeR3and earlier versions of the AsciiSrc, it is now
possible to specify an editable disk source. The file is not updated, however, until a call to
XawAsciiSave is made. When the source is in this mode the useStringInPlace resource is
ignored.
AsciiSrc objects of type XawAsciiString have the text buffer implemented as a string. MultiSrc
objects of type XawAsciiString have the text buffer implemented as a wide character string. The
string owner is responsible for allocating and managing storage for the string.
In the default case for AsciiSrc objects of type XawAsciiString,the resource useStringInPlace
is false, and the widget owns the string. The initial value of the string resource, and anyupdate
made by the application programmer to the string resource with XtSetValues,iscopied into
memory private to the widget, and managed internally by the widget. The application writer does
not need to worry about running out of buffer space (subject to the total memory available to the
application). The performance does not decay linearly as the buffer grows large, as is necessarily
the case when the text buffer is used in place. The application writer must use XtGetValues to
determine the contents of the text buffer,which will return a copyofthe widget’stextbuffer as it
existed at the time of the XtGetValues call. This copyisnot affected by subsequent updates to
the text buffer,i.e., it is not updated as the user types input into the text buffer.This copyisfreed
upon the next call to XtGetValues to retrieve the string resource; however, toconservememory,
there is a convenience routine, XawAsciiSourceFreeString,allowing the application program-
mer to direct the widget to free the copy.
When the resource useStringInPlace is true and the AsciiSrc object is of type XawAsciiString,
the application is the string owner.The widget will takethe value of the string resource as its
owntextbuffer,and the length resource indicates the buffer size. In this case the buffer contents
change as the user types at the widget; it is not necessary to call XtGetValues on the string
resource to determine the contents of the buffer—it will simply return the address of the applica-
tion’simplementation of the text buffer.
5.6.1. Resources
When creating an AsciiSrc object instance, the following resources are retrievedfrom the argu-
ment list or from the resource database:
Name Class Type Notes Default Value
callback Callback XtCallbackList NULL
dataCompression DataCompression Boolean True
destroyCallback Callback Callback NULL
editType EditType EditMode XawtextRead
length Length Int A length of string
pieceSize PieceSize Int BUFSIZ
string String String NULL
type Type AsciiType XawAsciiString
useStringInPlace UseStringInPlace Boolean False
callback The callbacks registered on this resource will be called every time the
text buffer changes, after the text has been updated.
destroyCallback All functions on this list are called when this widget is destroyed.
dataCompression The AsciiSrc uses an algorithm that may cause the text buffer to growto
about twice the size of the actual text overtime, as the text is edited. On
systems where CPU cycles are cheaper than memory,itishelpful to
spend some extra time to compress this buffer back to its minimum size.
92