Coding Fragment
Conversion of C to Pascal
An Example
Here is an example that illustrates the style of programming with the XView
interface in Pascal. This program:
•
Creates a vertical scrollbar with a view length of 100 pixels
•
Changes the view length to 200 pixels
•
Destroys the scrollbar
var bar, pi: Scrollbar;
begin
bar := xv_create ( 0, SCROLLBAR, 0 );
pi
:= xv_create_l ( 0, SCROLLBAR,
attr_create_list_4s
SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL));
set_SCROLLBAR_VIEW_LENGTH( bar, 200 );
xv_destroy ( bar );
In this example:
•
bar is declared to be of type Scrollbar.
•
xv_create() and xv_create_l() are invoked as functions.
•
set SCROLLBAR_VIEW_LENGTH () is invoked as a procedure.
•
xv_destroy() is invoked as a procedure.
Here is an example of a problem that you may encounter when converting C to
Pascal. It recommends some changes that you can make to work around the
problem.
The Problem—Besides the six standard generic procedures, there are
approximately 80 other procedures, plus hundreds of attributes. These are all
documented in the XView Programming Manual. The problem is that all of the
coding is in C.
The XView Toolkit
( SCROLLBAR_VIEW_LENGTH, 100,
10
227
Need help?
Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?
Questions and answers