Sample program – HP SunSoft Pascal 4.0 User Manual

Page 254

Advertising
background image

230

Pascal 4.0 User’s Guide

10

Sample Program

The following program,

xview.p

, makes a window:

To compile

xview.p

and link in the necessary libraries, use the following

command-line. Replace local_library_path with the path for the Pascal XView
libraries on your system.

hostname% pc -I

local_library_path

xview.p -L$OPENWINHOME/lib \

-lpxview -lxview -lolgx -lX11

Now run the executable file:

hostname% a.out

Soon after you run the executable file, the window opens as a single frame,
with the string

Hello, World!

in the frame header.

program hello(output);

#include "stddefs_p.h"

#include "attrgetset_p.h"

var

base_frame :Frame;

base_panel :Panel;

message :Xv_panel_or_item_ptr;

text :string;

begin

text :=

'

Hello, World!

'

;

xv_init(0);

base_frame := xv_create(nil, FRAME, 0);

base_panel := xv_create(base_frame, PANEL, 0);

message := xv_create(panel, PANEL_MESSAGE, 0);

set_PANEL_LABEL_STRING(message, text);

window_main_loop(base_frame);

end. {hello}

Advertising