63
Eindhoven University of Technology MASTER A new user interface for the ARCS antenna- and RCS-measurement system Derks, P.G.M.J. Award date: 1991 Link to publication Disclaimer This document contains a student thesis (bachelor's or master's), as authored by a student at Eindhoven University of Technology. Student theses are made available in the TU/e repository upon obtaining the required degree. The grade received is not published on the document as presented in the repository. The required complexity or quality of research of student theses may vary by program, and the required minimum study period may vary in duration. General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain

Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Eindhoven University of Technology

MASTER

A new user interface for the ARCS antenna- and RCS-measurement system

Derks, P.G.M.J.

Award date:1991

Link to publication

DisclaimerThis document contains a student thesis (bachelor's or master's), as authored by a student at Eindhoven University of Technology. Studenttheses are made available in the TU/e repository upon obtaining the required degree. The grade received is not published on the documentas presented in the repository. The required complexity or quality of research of student theses may vary by program, and the requiredminimum study period may vary in duration.

General rightsCopyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright ownersand it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights.

• Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain

Page 2: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

I::D Yi5EINDHOVEN UNIVERSITY OF TECHNOLOGYDEPARTMENT OF ELECTRICAL ENGINEERINGDigital Systems Group

ANew User Interfacefor the ARCS

Antenna- and RCS­Measurement System.

P.G.M.J. Derks

Master's Thesis

Supervisor: Prof. ir. M.P.J. StevensCoach: Dr. ir. V.J. VokurkaDate: january 1991 - october 1991

The department of Electrical Engineering of the Eindhoven University of Technology doesnot accept any responsibility regarding the contents of graduation reports.

Page 3: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Abstract

The Theoretical Electrotechnology group at the Eindhoven University of Technology usesa large software package for the analysis of antenna and ReS measurements. This packageconsists of several large programs and a number of utility programs written in Fortran.

Software has been written to convert the current applications to the Xll/Motif environ­ment. After analysis of the requirements of the different application programs a set of userinterface components is created. The creation of a user interface has been facilitated to apoint where major parts of the user interface can be specified by filling structures whichdescribe the user interface. In the software emphasis is put on the ease with which the userinterface components are created and placed. This software has been integrated with theFortran processing modules to create the new programs.

Page 4: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Acknowledgements

I wish to thank the following persons:

• My coach dr. Vokurka for making this project possible and his support.• Professor Stevens for his advice.• Bert Schluper at March Microwave Systems for answering all my questions regar­

ding ARCS.• Tonnie Geraets for finding bugs in my software and the helpful discussions.• Several persons on the Usenet network in the comp .windows. x and comp. windows. motif

newsgroups.

Page 5: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Contents

1 Introduction

2 ARCS2.1 Antenna and RCS measurements2.2 Measurement system.2.3 Software..............

3 The HP antenna measurement system3.1 The HP 8510 .3.2 The HP 85360A Antenna Measurement system

4 Target Systems4.1 PC and Unix system.4.2 BASIClUX .4.3 Data transfer . . . . .

5 Selection of windowing system5.1 Introduction .5.2 X .5.3 Presentation Manager5.4 Events and Queue's5.5 Callbacks5.6 Windows5.7 XVT5.8 Motif

6 Smalltalk6.1 Portability .6.2 Extensibility .6.3 Prices and availability

7 U nix on a high level PC7.1 Introduction .....7.2 X window system and Motif.7.3 Fortran .

1

2222

5

55

6

666

9

999

1010101111

13131313

14141414

11

Page 6: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

7.3.1 f2c.7.4 Selection .

8 Interfacing C to Fortran8.1 Calling Fortran from C8.2 Fortran source code . .

9 A new User interface for ARCS9.1 Concepts ..9.2 Dialog boxes9.3 Menu bar . .9.4 Entry fields .9.5 Option menus9.6 Drawing area .9.7 Help ..9.8 Layout ..

10 Requirements10.1 Image .

10.1.1 Description ..10.1.2 Requirements.

10.2 Imgate ..... ...10.2.1 Description ..10.2.2 Requirements.

10.3 Menu2D and 3D ...10.3.1 Description ..10.3.2 Requirements.

11 First test

12 Implementation using the Motif widget set12.1 Table widget12.2 Entry fields . . . . .

12.2.1 Focus ....12.2.2 Specification12.2.3 Callbacks

12.3 Option menus12.4 Menubar ...

13 Mutual influence13.1 Description ..13.2 Implementation.

14 Conclusions

1515

171717

181818181919191919

21212121222222232323

26

2727272727292930

323233

35

III

Page 7: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

A Organization of the sources

B Source RCS19.C

C Calling Fortran from C

D Rcs19f.f

37

38

42

43

E Overview of programming environments for Presentation-Manager andXII (Motif). 47E.! XVT 47E.2 Aspect 48E.3 Open Interface 48EA GKS...... 49E.5 Matlab .... 49E.6 Custom interface . 49E.7 Two seperate interfaces 50

F Table widget documentation. 51

IV

Page 8: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 1

Introduction

The Eindhoven University of Technology and March Microwave have developed a sofwarepackage for the analysis of antenna and radar cross section measurements (ARCS). Thissoftware runs on VMS VAX and HP-UX machines. Under the VMS operating systemgraphical output is sent to a VT240 terminal and on HP-UX systems the Starbase graphicslibrary is used. The software is developed over a number of years and the user interfaceand the presentation of data are presently outdated. HP has developed its own antennameasurement package which has a very nice user interface. The processing capabilities ofthis system are very limited (only antenna analysis) and extremely slow. As a result of thisonly the acquisition part of the software is usable. The ARCS software has very strongprocessing capabilities and is much faster than the HP software. If the user interface ofARCS would be made more up to date and easier to use this would be a most usefuladdition to the HP system. This new version of ARCS will have to run on OS/2 systemsand Unix systems, this automatically means Presentation Manager and the X windowsystem.

1

Page 9: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 2

ARCS

2.1 Antenna and ReS measurements

Antennas are designed primarily to give a specific distribution of energy in space whileminimizing loss and reflections. To evaluate the design of an antenna several measurementsare made which include radiation patterns, polarization and beam direction to name afew. RCS (Radar cross section) measurements are used to obtain information about thevisibility and detectability of objects with radar. It also is valuable as a means of identifyingtargets, for which time-domain techniques are invaluable. By imaging targets with the useof inverse synthetic aperture radar techniques, resolution in down-range and cross-rangecan be obtained.

2.2 Measurement system

A typical system for antenna and RCS measurements consists of a range with a receiver, atransmitter and instrumentation. On the transmitter side we have a frequency synthesizerand sweep generator and on the receiver end we have a network analyzer which also getsinput from the synthesizer to measure phase and amplitude characteristics. The synthesizerand network analyzer are controlled by a computer. This computer also controls a positionercontroller which in turn drives a positioner. The elevation and azimuth of the antenna ortest object can be altered with the positioner. In an anechoic chamber a parabolic or twocylindrical reflectors can be used to produce a flat wave front.

Currently only one hardcopy output device is support, a HP plotter or any other HP-GLdevice.

2.3 Software

ARCS consists of a large number of programs written in Fortran.

• ARCS: Acquisition and calibration program• Menu2D: 2 Dimensional presentation of results• Menu3D: 3 Dimensional presentation of results

2

Page 10: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

HP-IBHP 8510 Computer

~ Synthesizer PlotterV

PositionerPositioner

Controller

Figure 2.1: Antenna measurement system

HP-IB RS232HP 8510 VAX VT240

Controller Plotter

Figure 2.2: ARCS systen using VAX

3

Page 11: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

HP-IBHP 8510 HP 9000

Controller Plotter

Figure 2.3: ARCS systen using HP 9000

• Image: 2 Dimensional Fourier transformation• Imgate: Image gating• Filemath: File mathematics, data files can be added, subtracted etc.• RCSxx: Several programs to generate data files

Most programs are menu driven and the inputs are checked for correctness. A notableaspect is the fact that in several programs menu items influence each other. This meansthat as a result of the entry of one value the range or the value of another parameter ischanged. The user interfaces of the programs are not very consistent, some programs usethe F20 keys to exit, some the FlO key and others the F5 key. Some of the programs havea question and answer interface.

4

Page 12: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 3

The HP antenna measurement system

3.1 The HP 8510

The HP8510 network analyzer has become the defacto standard device for antenna measu­rements in recent years. It is a vector network analyzer which measures the magnitude andphase characteristics by comparing the incident signal with the signal transmitted throughthe antenna or reflected from its input. The HP 8510 can also perform Fourier transformson data stored in its internal memory. The device can be programmed by a computerthrough the GPIB bus (IEEE 488). Several vendors of antenna measurement systems usethis analyzer as acquisition device.

3.2 The HP 85360A Antenna Measurement system

To compete in the antenna measurement systems market HP has introduced a complete sys­tem for this purpose. It consists of a HP Rocky Mountains basic workstation (HP9000/320),a HP plotter and a HP8510 system. The workstation controls the devices with the GPIBbus. The software for the workstation consists of four programs:

1. Measure: This is used to configure and perform the measurement.2. View2D: 2 Dimensional presentation of the acquired data.3. View3D: 3 Dimensional presentation of the acquired data.4. Standard: To enter the published performance characteristics of a standard gain

horn.

The sofware consists of some 30000 lines Basic and 600 kilobytes of compiled subroutines.The graphical user interface is contained in these compiles subroutines. This interface iscute but impractical and inconsistent in places (see: Survey of the HP antenna Measurementsoftware). The software is adequate for antenna measurements but ARCS has more andbetter characteristics. Therefore March wants to build an add-on system which connectsARCS, including the RCS software, to the HP system. In this configuration the HP systemwould merely be used for acquisition while processing and presentation are done by thenew ARCS software. There are a number of ways to do this, these possibilities are exploredin the next chapter.

5

Page 13: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 4

Target Systems

4.1 PC and Unix system

We do not want to port the ARCS software to the HP Basic workstation so a second systemmust run the processing software. Two configurations are desirable:

1. High level PC running OS/22. HP workstation running Unix

The current OS/2 version is 1.3 which still runs on 286 class machines. The windowingsystem included with OS/2 is called the Presentation Manager. The next OS/2 release willbe a 32 bit version and this means that porting a Unix application to that version of OS/2will become much easier. One can also expect that the X Window system will be ported toOS/2. The HP workstation will be running HP's own version of Unix. This Unix is basedon System V and HP has provided a number of BSD extensions including TCP/IP.

4.2 BASIC/UX

HP has a product with which it is possible to run HP Basic programs on HP-UX. Thecurrent release of the HP antenna measurement software uses precompiled subroutines.These are subroutines written in Basic and compiled with a Basic compiler. BASIC/UXdoes not support these precompiled subs and this makes it impossible to run the antennasoftware on HPlUX. The next release of the antenna software will run on BASIC/UX.This means that a configuration will be possible with only one HPlUX system which willrun both the new ARCS software and the HP antenna software.

4.3 Data transfer

There are a number of possibilities to transfer the acquired data to the processing system.The options are:

1. floppy2. RS2323. IEEE-488

6

Page 14: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Positioner

HP-IBHP-8510 HP-BASIC OS/2 system

Figure 4.1: PC configuration

Positioner

HP-IBHP-8510 HP-BASIC HP-UNIX

Figure 4.2: HP configuration

Positioner

HP-851O HP-UNIX

Figure 4.3: Single HP Unix system

7

Page 15: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

4. TCP/IP

Walking around with floppies or serial transport using RS232 are not really options becausethe amount of data can be quite large. The HP Basic system can be equiped with anethernet card but there is no software support. Third party software is available but thisdoes not implement a TCP/IP server mode. All HP systems are equiped with IEEE-488(HP-IB or GP-IB) interfaces and HP Basic and HPlUX support this interface. The IEEE­488 interface has a transfer rate of 10 megabyte per second which is quite adequate for filetransfer. In the last configuration (single HP-UX system) there is no file transfer problembecause BASIC/UX uses the standard file system.

8

Page 16: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 5

Selection of windowing system

5.1 IntroductionI have tried to find the differences and similarities between the OS/2 presentation managerand X and have done a comparison of some of the key elements of the systems. One majordifference is the fact that in the X environment the server (the display) and the clients(the application programs) are not necessarily running on the same computer.

5.2 XThe standard graphical environment for Unix systems is the X window system. It has beendeveloped during several years at MIT and DEC. The X window system is known by thenames X11, X version 11 or just X. X is a message passing system, X clients (applicationprograms) send requests to an X server. X organizes windows as a hierarchy, referred to asthe window tree. The top window in this window tree is known as the root window/ TheX server automatically creates a root window for each screen it controls. The root windowoccupies the entire physical screen, and cannot be moved or resized. Every window exceptthe root window has a parent window and can have one or more child windows. Windowswhich share the same parent are called siblings.

X in its most basic form comes with Xlib which is a library of functions which createand send requests. This is the lowest level of X programming. There are several toolkitsavailable to facilitate programming applications for X. These toolkits are built on the XtIntrinsics. The Xt Intrinsics serve as a framework that allows programmers to create userinterfaces by combining an extensible set of user interface components. These componentsare called widgets. The widgets determine the look and feel of a program. There are severalsets of widgets available, for instance the Athena widget set, the OSF/Motif widget setand the Open Look widget set.

5.3 Presentation Manager

The Presentation Manager is the primary application environment under OS/2. Program­ming for PM is done with the PM application program interface (API). The user interface

9

Page 17: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

and the API of PM are largely derived from Microsoft Windows. Currently OS/2 and PMare being updated. OS/2 2.0 will support the 80386 and 32 bit programs and the API ofPM will become almost identical to the MS Windows 3.0 API. This will make the portingof programs from MS Windows to PM easier.

5.4 Events and Queue's

The windowing system needs to send messages to applications when keys are pressed, themouse pointer moves, a mouse button is pushed etc. In X these items are called events andin PM these are called messages. The main information processing loop looks like this forPM:

while (WinGetMsg (hab, &qmsg, NULL, 0, 0»WinDispatchMsg (hab, &qmsg)

And this is the event processing loop for X:

done = 0;while ( done == 0 ) {

XNextEvent ( mydisplay, myevent );switch ( myevent.type ) {

5.5 Callbacks

A callback function is used by the windowing system to report events which have occuredin a window to that particular window. The X toolkit provides the XtAddCallback functionto register new callback functions. This means that callbacks are registered dynamicallyat run time. For PM callback functions must be declared in a special .DEF file at compiletime.

5.6 Windows

One of the more basic functions of a windowing system is the creation of windows on thedisplay. Table 5.1 contains a comparison of the calls used in PM and X.

One can see from this table that there are certain similarities in the parameters i.e. initialsize and position of the window, but the order is different. Also different are the returnvalues from the two calls, XCreateWindow returns a Window variable and WinCreate­Window returns hwnd which is a handle (pointer) to the window. Another problem are

10

Page 18: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

the attributes or pControlData, this parameter determines the style of the window. Thisincludes things like the width of the border and the gravity of the new window. Theseproperties are defined as masks in the include files and these are 100% different. In PMthe window exists after the call to WinCreateWindow but in X the window still has to bemapped on the display after it has been created with XCreateWindow.

5.7 XVT

From the abovementioned differences it is clear that we can't hide the differences betweenthe windowing systems with some simple #define's. In appendix E we discuss the possiblesolutions for this. After evaluating these solutions we came to the conclusion that using atoolkit was the best option.

5.8 Motif

In Motif user interfaces are built using widgets. A widget is an X window along with someprocedures that manipulate the window. Each widget maintains a data structure that sto­res additional information used by the widget's procedures. Applications are constructedby combining widgets on the screen rather than opening a window and drawing everythingyourself. Widgets behave like objects in an object oriented language. Widgets belong toclasses of widgets that inherit properties from eachother. Also widgets take care of them­selves when expose or resize events occur. In addition to widgets, Motif provides a userinterface component known as a gadget. Gadgets are identical to widgets, except that theyhave no window of their own. In plain X the programmer needs to deal with all theseproblems himself. To get acquinted with the object oriented architecture defined by the XtIntrinsics and all the widgets provided by Motif takes at least as much time as learning anew programming language. An advantage of Motif is the built-in system to provide helpwith menu items and dialog boxes. The main loop for a Motif program looks like this:

while ( TRUE ) {Xevent event;XtNextEvent(levent)XtDispatchEvent(levent)

The best way to represent and design a Motif application is by using a widget tree. Thewidget tree for a simple application could look like figure 5.1.

11

Page 19: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

bb

(XmBulletinBoard)

do quit panel(XmPushButton) (XmPushButton) (XmRowColumn)

frequency editl(XmEdit)

Figure 5.1: Widget tree of a simple application

Table 5 1· Create window functions..Xll PMXCreateWindow WinCreateWindowdisplay hwndParentparent szClassNarnex szTexty WS_...width xStart, yStartheight xSize, ySizeborder-width hwndOwnerdepth hwndOrderclass idChildvisual pControlDatavaluemask pPresParamsattributes

12

Page 20: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 6

Smalltalk

Smalltalk is an object oriented programming language and environment. It is very wellsuited for the design of graphical user interfaces. It uses the underlying windowing systembut uses it's own flavor of windows, popup menu's and dialog boxes. Smalltalk also actsas an execution environment. Executable programs are stored in p-code. Applications areneither compiled nor interpreted but there is a cache in memory where code is stored afterit has been compiled and executed for the first time. Succesive execution of the same codeis therefore much faster. An application designed with Smalltalk is somewhat slower thanan identical application written in C++.

6.1 PortabilityThere are two major versions of Smalltalk, Smalltalk V and Smalltalk 80. Smalltalk 80 runson Apollo, Sun and other Unix systems. Smalltalk V is available for MS DOS, Windows3.0 and OS/2 PM. Porting a large design package from Smalltalk V to Smalltalk 80 at thedigital systems group took three months.

6.2 Extensibility

Smalltalk comes with a large library of objects and methods. This is not only convenient butnecessary because Smalltalk is a closed system, interfacing to other languages is possiblebut difficult.

6.3 Prices and availability

The University has a site license which costs DM 2000 per year, for each platform anadditional license of DM 300 has to be paid. Versions of Smalltalk are available for allpopular systems, the University has versions for Apollo, Sun, OS/2 and MS DOS.

13

Page 21: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 7

Unix on a high level PC

7.1 Introduction

Since the introduction of the 386 microprocessor PC's have become powerful enough torun a complete Unix operating system. Unix has been implemented on the 386 by severalvendors including AT&T, SCO, Dell, Interactive and Everex. The typical configurationneeded to run Unix on a 386/486 computer consists of 4 MB ram (8 MB for X), 100 MBharddisk and a VGA card and monitor. Executables for one UNIX/386 system will workon any other UNIX/386 because all vendors adhere to the Intel ABI (application binaryinterface).

7.2 X window system and Motif

Each vendor of Unix for 386 systems also sells an X server for their Unix. Support of videocards differs greatly, all support the standard 640 by 480 16 color VGA card, and mostservers come with drivers for several higher resolution boards. There is one public domainX server implementation available which supports resolutions of up to 1152 by 900 on asuitable monitor.

7.3 Fortran

There are at least 3 fortran compilers available for 386 Unix systems, these are MicrosoftFortran, LPI Fortran and Microway Fortran.

One report concerning the Microway Fortran compiler (also called NDP Fortran) statedthat programs compiled with this compiler on a 486 33 MHz system with Weitek 4167coprocessor ran just as fast as on a Sparcstation 2 (40 MHz). Microway is represented inHolland by Intra Electronics in Nuenen.

There exists also a public domain Fortran to C translator called f2c which originates fromAT&T but this only supports Fortran 77 and not the VMS Fortran extensions.

14

Page 22: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Table 7 l' Fortran compilers for Unix 386· .Microsoft Fortran LPI Fortran Microway Fortran f2c

32bit code No Yes Yes YesVMS Fortran extensions Yes Yes Yes NoWeitek support No Yes Yes YesPrice DM 2050 $ 799 f 2628 0Educ. price -38% $ 500 - 0

7.3.1 f2c

The program f2c makes it possible to compile and run fortran programs on Unix systemswhich do not provide a fortran compiler. To do this f2c translates the fortran code into Cafter which it is compiled by the native C compiler. The purpose of f2c is not to convertfortran programs to C and then continue with the C program but f2c makes it possibleto continue using existing fortran programs. The f2c program is written at Bell labs andavailable from the anonymous ftp site research.att.com. It can be used on any 32 bit Unixsystem which includes 386 Unix versions.

Included with f2c are two packages which emulate the normal Fortran libraries. To compilea program with f2c you just type f2c source. f, the resulting source. c includes f2c. hand has to be linked with -lI77 -lF77 -1m to create an executable program.

I have tried to compile the sources of the ARCS processing package with f2c and havehad reasonable succes. Most mathematical routines compiled with no problems but severalmodules dealing with the user interface wouldn't compile. A common source of error wasthe use of the type statement which isn't supported by f2c. Also all the programs which usethe HP Starbase library can not be compiled because the Starbase library is not availablefor 386 systems running Unix.

7.4 Selection

Our initial target systems were OS/2 and Unix. This means that the ARCS software packa­ge should run under PM and the X window system. Because of the substantial differencesbetween these two windowing systems we have been looking for a toolkit which createsa common programming interface to the two windowing systems. After some research weonly found XVT to be a reasonable choice. However, this choice has some disadvantages.

If we were to choose XVT this would have the following consequences: To start developingin XVT we would need the PM Toolkit which costs £1000,- and XVT for OS/2 which costs$795. To develop on the HP340 machines at March we would only need XVT for Motifand this costs $3495. The total cost would be around f9600,-.

Another problem asociated with XVT is the fact that we would become 100% dependenton this product and the company which sells it. Sources are available for $5000 to $10000

15

Page 23: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

depending on the platform but this would mean that March should do the maintenance onXVT if PM and/or Motif would change.

Because market acceptance for OS/2 is still very low it was eventually decided to dropOS/2 as target system. This did not mean we also dropped a 32 Bit PC as hardwareplatform because such a PC can also run Unix and the X Window system. This facilitatesour decision because we are only left with a single windowing system.

16

Page 24: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 8

Interfacing C to Fortran

8.1 Calling Fortran from C

It is relatively easy to interface Fortran to C, the calling conventions are the same for Cand Fortran. Ints in C become INTEGERS in Fortran and floats become REALS. Thevariabels are passed by reference, so the parameters from C must be passed with adressesor pointers. Strings are not null terminated in Fortran but are stored as a length countfollowed by the string itself. To pass strings from C to Fortran the string itself must bepassed and as extra parameter the length of the string must be passed as the last variablein the parameter list. Passing strings from Fortran to C only involves appending an extra'\0' to the string. Linking must be done with cc or the main function will not be found. Toresolve the problem of undefined externals which arise when linking C and Fortran objectsthe following libraries must be added to the link command: libF77.a, libI77.a and libFext.a.

8.2 Fortran source code

The Arcs package is almost entirely written in Fortran. Heavy use is made of non Fortran77 features. The programs have to be altered in order to make it possible to call themfrom C as subroutines. This is a very laborous task because the interface to the user is notalways confined to one module, which makes it necessary to rewrite large parts.

17

Page 25: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 9

A new User interface for ARCS

9.1 Concepts

There are a number of goals we want to achieve with the new user interface:

1. Transistion from the old user interface to the new must be simple.2. Uniform user interface for all ARCS programs.3. The interface must be easily adaptable for new programs.

To achieve the last goal we must isolate the application-dependent code as much as possiblefrom the user-interface code. The precise user interface for any particular ARCS programmust be specified as much as possible in structures and include files and not be hard-codedin the application. In the next paragraphs common requirements for all applications arediscussed.

9.2 Dialog boxes

Dialog boxes are popup windows which can be used for several purposes. An example is afile selection box, this is a popup dialog in which a number of items are displayed. The fileselection box must consist of a window which displays the files in a directory, a directoryspecification area and a filter area. The filter can be used to enter a wildcard string againstwhich the files in a directory are checked. Dialog boxes can also be used for warning anderror messages and to inform the user that a time consuming operation is running.

9.3 Menu bar

A menu bar is a horizontal bar in which a number of labels are placed. If a label is activated,either with a key combination or by using the mouse, a pulldown menu appears in whichan item can be selected. An item in a pulldown menu can itself consist of another pulldownmenu. This second pulldown menu must be placed adjacent to the already visible pulldownmenu.

18

Page 26: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

9.4 Entry fields

There are four types of field items:

• Normal fields• Fixed fields• Calculated fields• List fields

All fields consist of a label field and an entry field. Normal fields are used to change numericor alphanumeric values, for instance start and stop frequencies and labels of axes. The entryfield is right next to the title field, if the mouse pointer is in the entry field the user can typea value. The one exception to these rules are file names. To input a filename a file selectionbox is used. Fixed fields are displayed in a different color than normal fields. In thesefields parameters are shown which follow directly from the input file(s). Calculated fieldsshow parameters which are calculated as a result of the values entered in normal fields.These parameters are shown in another different color. List fields are used for parametersfor which only a fixed (small) set of choices is possible, they are described in the nextparagraph.

9.5 Option menus

An option menu is a list of choices of which one can be chosen. On the screen the optionmenu is displayed as a button, if a mouse button is clicked on the button a list pops upwhich displays the list.

9.6 Drawing area

All ARCS programs use graphics to display measurement and processing results. Thismeans that we have to reserve an area on the screen for these graphics, such an area isknown as a drawing area.

9.7 Help

Every menu item, push button or radiobutton must be accompanied by a context sensitivehelp page.

9.8 Layout

All programs must have a uniform layout and identical functions in all programs mustwork the same way. All applications will consist of three major elements, a menu bar ontop, a large drawing area on the left side and a list of entry fields on the right side of thescreen. (See figure 9.1)

19

Page 27: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Menu bar

Drawing areaTable

Status line IFigure 9.1: General screen layout

We have chosen for a fixed screen layout to make the user interface as uniform and con­sistent as possible. The menu bar on top will hold a title, common pulldown menus forfile selection and the quit button. If the entry form on the right side is not big enoughto hold all the entries there will be several pages on top of each other. Entries will begrouped in logical sets and each entry form will have a title. We are deliberatly not usingall the features (like popup menus) which Motif gives us to make the learning curve aslow as possible for users who are familiar with the old ARCS software or the HP antennameasurement package.

20

Page 28: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 10

Requirements

10.1 Image

10.1.1 Description

The IMAGE program is used to calculate an image by performing a 2-dimensional Fouriertransform of the measured RCS as function of frequency and aspect angle. The down­range response essentially is the Fourier transform to the frequency response of the targetobtained with a frequency ramp. The cross-range response is the Fourier transform of theangular variation of the reflection.

10.1.2 Requirements

Image currently consists of two menupages, a text only entry form and a graphics screenin which a simple 2D cartesian plot can be made. To aid in choosing the parameters it willbe possible to place markers in the graph. If a user clicks a mouse button on the markera small text window will appear above the marker which diplays the span (the span isdetermined by the resolution), center angle and other parameters (and a close option toremove the text). The entry form has these fields:

• Input file• Output file• Function (read from file, HH or VV)• Window (Normal, Hanning, Hamming etc.)• Correction (On/Off)• Start frequency• Stop frequency• Number of frequencies (read from file)• Start angle (read from file)• Stop angle (read from file)• Number of angles (read from file)• Cross Range

Cell sizeResolution

21

Page 29: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Target sizeNumber of cellsTotal image sizePoints per cell

• Down RangeCell sizeResolutionTarget sizeNumber of cellsTotal image sizePoints per cell

• Processing Error• Center minimum• Center Maximum• Angle span• Center angle

In the graphics page of Image markers can be used to read the value of the function andset various parameters. There are also three softkeys, Exit, RCS plot and Process. Processand RCS plot will become pushbuttons.

10.2 Imgate

10.2.1 Description

Imgate is used to remove or isolate rectangular parts of an image and calculate the resultingRCS. After the first 5 items are entered (see next paragraph), imgate draws a contour ploton the screen. In this plot the rectangular area can be selected by giving center and span(vertex) or start and stop points.

10.2.2 Requirements

Imgate consists of one page, on the right side are adjustable parameters and on the leftside a list of instructions is displayed. After the first parameters are entered a contour plotis placed over the instructions. The entry form has these fields:

• Input file• Output file• Function (read from file, HH or VV)• Down Range (of graph)• Cross Range (of graph)• Contour (list of number of levels)• Gate shape (minimum, normal, maximum)• Down Range (start, stop)

• gate

22

Page 30: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

• #cells• Cross Range (start, stop)

• gate• # cells• Mode (general, bandpass, bandstop)• Filter

db within gatedb outside gate

Selection of the rectangular section can be done in two ways: by selecting center and thenmoving the mouse to a vertex or by selecting one vertex and moving to the other vertex.

10.3 Menu2D and 3D

10.3.1 Description

The Menu2D and Menu3D programs are used to display graphical data obtained fromthe measurements or processed measurements. The menus of these two programs are verysimilar. On VMS computers a VT240 terminal is used to display the graphs. The terminal isprogrammed with the REGIS language. HP 9000 computers display graphs on the consolewhich in most cases is a 1024 by 768 pixel display. This display is programmed with theStarbase graphics library. These libraries are very different so the code which programs thedisplays is concentrated in a few routines. The new target will only be the X window systembut we have also concentrated the output routines in one source file to make adaption toa different windowing system as easy as possible.

10.3.2 Requirements

Based on the current functions of the Menu programs we have made a list of the functionsthat should be present in the new programs. We obtained this information from the ARCSGraphics Reference Manual. This took some time because this manual is a classic exampleof how manuals shouldn't be written.

1. Grid: The type of graph is chosen in this menu• Cartesian• Polar• 2 Polars• Polar & Cartesian• Cartesian & Polar• Horizontal split• Vertical split

2. Graph: Two graphs can be displayed at anyone time, they are called A and B.3. File: Filename4. Function: Name of the function to be displayed, the names are extracted from the

data file.

23

Page 31: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

5. Axis names6. Axis range7. Axis types: choose from

• Log. mag.• Phase• Lin. mag.• Real part• Imaginary part• Nyquist (only contour plot in Menu2D)

8. Format range and contour levels9. Output device:

• Display• Plotter• Table in file (Table must become a separate option)• Table on display

10. Parameters11. Size of comment

• Small, 77 characters• Big, 38 characters

12. Graph giving the comment

• none

• A• B• A and B

13. Graph giving the annotation

• none

• A• B

14. Viewing angle (3D only)• isometric• dimetric• waterfall

15. Layout of contour plots:• contour lines• color map• contour lines plus marginal plots• color map plus marginal plots

16. Grid type (2D and contour)17. Markers18. Graph: graph for which the markers are set, A or B19. Reference marker: One marker can act as a reference, here the marker number is

shown20. Marker to be operated

24

Page 32: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

21. Narne of vertical independent grid axis (for reference only)22. Vertical position display, if a value is entered here the marker jumps to the indicated

value23. Name of horizontal independent grid axis (for reference only)24. Horizontal position display, if a value is entered here the marker jumps to the

indicated value25. Format of the dependent grid axis26. Function value (display only)

25

Page 33: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 11

First test

To test Motif and the development system I built a prototype application program usingRCS19. This is a program which calculates and creates a data file that contains timedomain (range) vs. aspect angle data. The program produces a data file which simulatesthe HP8510 network analyzer for uncorrected radar imaging with a question and answerstyle interface. The source of this program is given in appendix B

26

Page 34: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 12

Implementation using the Motif widget set

12.1 Table widget

Table is a composite widget designed to manage the size and location of its children.Appendix F contains the entire documentation for the table widget. The widget uses anarray model to simplify the arrangement of child widgets. The widget is directly derivedfrom the core and composite widgets provided by the X Toolkit and can be used withany widget set. The Table widget addresses formatting for dialog boxes. Dialog boxes arerectangular windows that contain a wide variety of widgets. Most dialog boxes are arrangedwith widgets aligned in a way similar to the layout found in business forms. The Tablewidget is designed to make such layouts easy to specify.

When designing dialog boxes that resemble business forms, the primary problem is specify­ing the alignment between widgets. The Table widget addresses this problem by adoptingan array model. Under this model, widgets are placed at row and column locations in avariable sized array. Widgets may span more than one row or column. The array can ex­pand or contract in pixels - as needed. There are options to control justification and placesize restrictions on rows and columns of widgets.

12.2 Entry fields

12.2.1 Focus

When a text widget gets the focus i.e. is ready to take input the text_callback is calledand the current contents of the widget is saved. When the user moves to another field thetext_callback checks if the contents have changed. If this is the case a recalculation takesplace. This happens also if the return key is pressed. If the escape key is pressed the oldcontents of the text widget are restored.

12.2.2 Specification

The description of the layout and functions of the entry field is in the include file entries. h.It would have been possible to put this description in a file which is read by the application

27

Page 35: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

at start up time, but this would make it possible for ordinary users to change the file andthereby introduce errors. This is the structure which defines the entry fields:

struct entry {

String name; /* name of the widget to be created */int widgettype; /* widget type */int widgetindex; /* index to the created Widget */String label; /* text which is in the label widget */Position row; /* row in the table widget where the widget */

/* is to be placed */Position col; /* column in the table widget where the widget */

/* is to be placed */int width; /* number of columns for text widget */Dimension h_span; /* horizontal span in columns */Dimension v_span; /* vertical span in rows */XtTblMask opt; /* options (See table widget documentation) */void *varp; /* pointer to variable */int var_type; /* type of variable */

};

Here follows a more precise description of the various parameters:

• name: The name of the widget, this can be used in a resource file to change re­cources of the widget.

• widgettype: the type of widget to be created, currently 3 widget types can bespecified: TEXT_WIDGET, LABEL_WIDGET and SEPARATOR_WIDGET.

• widgetindex: This number must be an item from the enumeration which is declaredin the main include file for the application.

• label: If the widget is a label widget this field contains the text for the widget.• row: The row in the table widget where the widget is to placed.• col: The column in the table widget where the widget is to placed.• width: If the widget is a text widget this field specifies the width of the field in

characters.• h...span: The number of columns the widghet should span.• v...span: The number of rows the widget should span.• opt: Adjustment of the widget in the table widget (see Table widget documenta­

tion).• *varp: If the widget is a text widget this is a pointer to the location of the variable

which is associated with this entry field. If not, this field contains NULL.• var_type: The type of variable the pointer (see previous item) is pointing to. Cur-

rently 3 types are possible: TYPE.-NONE, TYPE-FLOAT and TYPEJ:NT.

By using the XmAddTabGroup function all the entry widgets are placed in a tab group. Atab group specifies a set of widgets within which the user can use arrow keys to traverse thewidgets. With the functions set_text-widget-active and set-text_widget_inactive a

28

Page 36: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

widget can be made part of the tab group or removed from it. A tab group must consistof a single container widget, in this case the table widget.

12.2.3 Callbacks

A single callback function is used for all the text widgets in the table widget. With thepointer and the type of variable from the specification structures the entered value can bechecked. The widgetindex number is passed to the calculation module of the application.

12.3 Option menusAn option menu consists of the following widgets: a pulldown menu pane which holds thepush button gadgets and the option menu widget. We want to use several option menus inthe table widget but this creates a problem because an option menu consists of two widgetsand the child of a table widget must be a single widget. We therefore use a bulletin boardas an intermediate widget which holds the pulldown menupane and the optionmenu. Thereare a number of option menus in which the number of items change as a result of a changein certain parameters. An example of this in the IMAGE program is the NUMBER OF CELLS.

This option menu must be filled with powers of 2 starting with O.

i = 0;while ( (i < MAXSER) tt «l«i) < number_of_freq) ) {

nrcelldr[i] = l«i;i = i+l;

}

As can be seen from this fragment of code the contents of the array can change if another file is read (new number of frequencies). When we try to destroy the option menu(by destroying the bulletin board which holds it) the table widget starts resizing andrearranging all the widgets which takes a long time. To solve this problem we introduceanother bulletin board widget which holds the bulletin board widget which contains theoption menu. When we want to change the option menu we destroy the bulletin boardwidget which holds the option menu and we create a new one. (See figure 12.1) One itemin an option menu is specified as follows:

to the callback *1active or not *1

the name of the item *1mnemonic for the item *1callback to be invoked *1client data which is passeddetermines if the option is

_option_struct {*item; 1*mnemonic; 1*(*func) 0 ; 1*data; 1*sensitive; 1*

typedef structcharcharvoidcaddr_tint

} option_struct;

Usually all the callbacks for an optionmenu will point to one callback function, the clientdata will be used to set the parameter associated with the option menu. However, this isnot a requirement and different callbacks can be specified.

29

Page 37: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

BulletinBoard

IBulletinBoard

---- ~PullDownMenu OptionMenu

PushButton

PushButton

PushButton

PushButton

Figure 12.1: Option menu widget tree

12.4 Menubar

The menubar in the top row of the application consists of a number of buttons which whenactivated display a pulldown menu. In turn these pulldown menus can have pulldown menusattached to them. See figure 12.2 for an example.

To simplify the creation and changing of a menubar the menubar can be specified with thefollowing structure.

name;(*func) 0;data;*sub_menu;n_sub_items;*sub_menu_title;

typedef struct _menu_struct{char*voidcaddr_tstruct _menu_structintchar

} menu_struct;

1* name of the button *11* Callback to be invoked *11* Data for the callback *11* data for submenu of this button *11* How many items in sub_menu *11* Title of submenu *1

The function which handles these structures interprets these in a number of ways. Eachitem in the topmost menu-.Struct (which creates the actual menubar) should have only aname and a submenu. The function which creates the menus loops through the array ofmenu entries creating an appropiate widget for each entry. If a title is given, the functioncreates a label widget as a title, separated from the rest of the menu by a separator widget.For each item in the menu description, if the name of an entry is given as NULL, the function

30

Page 38: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

I Menu 1 Menu 2I

Item 1

Item 2 SubMenu

Item 3 Item 2A

Item 2B

Figure 12.2: Menu bar example

creates a separator widget. If the entry has a name and a callback function, the functioncreates a pushbutton widget and assigns the callback. If the entry has a name, but nocallback function, and the submenu member is NULL, a label widget is created. Finally, ifa submenu is specified, the function creates an XmCascadeButton widget and a pulldownmenu, and attaches the pulldown menu to the menu entry, after adding the entries in thesubmenu to the pulldown menu by calling the function recursively.

31

Page 39: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 13

Mutual influence

13.1 Description

The entry form of Image has some special problems associated with it because several entryfields influence other entry fields. As a graphical aid the original author has constructed amatrix in which the dependency relations are represented by a cross when one parameterinfluences another. A cross on the diagonal indicates that this parameter can be changedby the user. All the parameters are listed on the left hand side of the matrix and acrossthe top. They are listed in the same order on the left hand side and across the top. Bystarting at the left hand side of the matrix you can see what other parameters changewhen the input parameter changes. The matrix has been arranged in such a way that arow parameter only influences parameters which are listed under that parameter. To avoidcircular changes in parameters the lower left triangle of the matrix must be kept zero.

This is impossible to achieve for the parameters cell size Down Range and cell size CrossRange, so this must be handled as a special case. An m means that a change in the rowvariable results in a change in the boundaries of the column variable.

For instance if the target size is adjusted the maximum value for the corresponding pointsper cell array is affected.

i = 0;while ( (1«i) > ( (OMAX-1)/nr_cell_dr ) ) {

i++;}

max_opt_dr_ppc = i;

Cell size Down Range is used as a starting point for the initial calculations.

The original implementation in Fortran makes heavy use of computed goto's and is notcommented at all. As a result it is almost impossible to change or add anything to thedependencies. The new implementation must facilitate the making of changes or additionsin the dependencies.

32

Page 40: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

1 2 3 4 5 6 9 10 11 7 8 17 23 12 18 13 19 14 20 15 21 16 22 24 25 26 27 28Ilnpul file 1 x x x x x x x x x x x x xOulpul file 2 xFunction 3 xSlar! f 4 x xSlOp f 5 x x# freq 6 xStart angle 9 xSlop angle 10# anglea 11Window 7 x x x xCorrection 8 x xP/Cell DR 17 x mP/Cell CR 23 x mCellaize DR 12 m m x x x x x x x x x x x x x x xCellaize cR 18 x xRea. DR 13Rea. CR 19Targelaz.DR 14 m x x x xTarge18z. CR 20 m x x x x# cella DR 15 m x x# cella CR 21 m x xImagen. DR 16Imagen. CR 22Proc. error 24Bore leU 25Bore righ1. 26Angle Span 27Center anI:. 28

Table 13.1: Influence matrix for Image

13.2 Implementation

The influence problem is not unique for Image but occurs (in a much simpler form) also inother ARCS programs.

All the parameters are declared as global variables. Associated with each parameter is anarray which holds function pointers to functions which calculate the value of a particularparameter. When an entry form (an xmText widget) loses the focus because the user hasclicked on another widget or has used the arrow keys to move to another field, a functionis called which calls all the functions listed in the dependency array for that parameter.This structure is shown in figure 13.1

33

Page 41: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Figure 13.1: Influence array structure

Funktion 1

Funktion 2

Funktion 3

Funktion 4

34

Page 42: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Chapter 14

Conclusions

It is relatively easy to convert existing applications to X windows with the written software.Separating the user interface code from the processing code in the existing fortran sourcesis a very laborous task.

The choice of Motif to develop the user interface has been very appropriate, all requirementscould be fulfilled with the Motif widget set.

The learning curve for Motif and the X window system is very high as a result of thecomplexity of the combination and the need to use Xlib functions in several cases.

A minimum completion and realisation of the conversion of the ARCS package to the Xwindow system woul involve:

• Conversion of Imgate• Conversion of Menu2D and Menu3D

A completely new package would also involve:

• New version of ARCS data aquisition• Batch processing• Command history• New file format

Based on the experience gained in this project I would estimate that this could take up totwo years to realize with experienced programmers.

35

Page 43: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Bibliography

[:I.] Usenet News: Frequently asked question (FAQ) list comp.windows.x.motif[2] Usenet News: Frequently asked question (FAQ) list comp.windows.x[3] ARCS File Reference Manual, First Edition, Release 1.2. March Microwave Systems

B.V. august 1988.[4] Kernighan, Brian and Ritchie, Dennis. The C Programming Language Second Edition

Prentice Hall, Englewood Cliffs, N.J. 07632[5] A Fortran-to-C Converter, Computing Science Technical Report AT&T Bell Labora­

tories august 1991.[6] Geraets, A.G. A New Graphics Interface for the ARCS Antenna- and RCS­

Measurement System. Master's thesis, Eindhoven University of Technology, Depart­ment of Electrical Engineering, october 1991.

[7] OSF/Motif Programmer's Guide: Toolkit, Revision 1.0, 1989. Open Software Foun­dation, Eleven Cambridge Center, Cambridge, MA 02142.

[8] OSF/Motif Programmer's Reference Manual, Revision 1.0, 1989. Open SoftwareFoundation, Eleven Cambridge Center, Cambridge, MA 02142.

[9] OSF/Motif Style Guide, Revision 1.0, 1989. Open Software Foundation, Eleven Cam­bridge Center, Cambridge, MA 02142.

[10] OSF/Motif Release Notes/Porting Guide, Revision 1.0.A, 1990. Open Software Foun­dation, Eleven Cambridge Center, Cambridge, MA 02142.

[11] X Manual Set. Volume 2: X Library Interface, first edition, 1988. Addison-WesleyPublishing Company.

[12] X Manual Set. Volume 3: X Intrinsics & Athena Widgets, first edition, 1988. Addison­Wesley Publishing Company.

[13] Young, Douglas A. The X window system: programming and applications with Xt /OSF/Motif edition. Prentice Hall, 1990.

36

Page 44: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Appendix A

Organization of the sources

The sources are located in the directory - paul/work/image. Imakefiles are present tobuild the executables. The subdirectory fortran contains Fortran sources of modules whichare nessecary for the programs. There is an Imakefile to compile and link the Fortranmodules to build a library. This library is linked with the C sources.

imagel.c Initializes the intrinsics and creates the form widget, the menubar, thestatus line and the table widget

image.h This include file is used by all the application dependent source files forimagel. It includes the necessary system include files and defines the struc­ture in which the global parameters are stored and the array and theenumeration for the widget identifiers.

entry.c Functions for filling and manipulating the entries in a table widget.entry.h Defines the structure for the entry field declarations.

entries.h Contains the declaration of all the Text, Label and Separator widgets inthe Table widget. This file has to be carefully synchronized with tabopts.c

table_cb.c Common callback for the Text widgets in the Table widget.tabopts.c Creation of the option menus in the table widget and callbacks for all

these option menus.tabopts.h Definitions of the structures used for the creation of the option menus.

popup.c Creation of the popup dialog boxes (including the file selection box).options.c Functions used for creating and changing option menus.options.h Defines the structure for the optionmenus declarations.

calc.h Contains definitions of some constants.calc.c Functions to recalculate the entry fields when parameters are changed.

repfile.h Defines a structure which holds the fourth page of an ARCS report file.readrep.c Reads an ARCS report file, returns a pointer to a structure which holds

all the information.libxs.h Definitions and prototypes for the functions from the xs library described

in [13].util.c Several utility functions.

color.h Definitions for the colors for the various parts of the user interface.menus.h Definitions for the structures for the menubar declarations.

37

Page 45: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Appendix B

Source RCS19.C

/********************************************************************* rcs19.c: Simple example of a new user interface for rcs19*******************************************************************/

#include <X11/Intrinsic.h>#include <Xm/Xm.h>#include <Xm/Text.h>#include <Xm/PushB.h>#include <Xm/Label.h>#include <Xm/BulletinB.h>#include "libXs.h"

#define items 8

void get_text 0 ;void the_endO;void calculate();

char *labels[itemsJ = {"Target number","Start frequency","Stop frequency","Number of freq.","Start angle","Stop angle","Number of angles","Filename"};char *editors[itemsJ;char *buttons[itemsJ;

main(argc, argv)int argc;

38

Page 46: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

ehar *argv[];{

Widget toplevel, bb, label[items], edit[items], button[items];int i;Arg al[40];int ae;

toplevel = Xtlnitialize(argv[O], "Res1g",NULL, 0 , large, argv);

ae=O;

/** Create the XmBulletinBoard widget that manages* the edit fields.*/

bb = XtCreateManagedWidget("board",xmBulletinBoardWidgetClass,

toplevel, NULL, 0);/*

* Create single line XmEdit widgets*/

for(i=O; i < XtNumber(editors); i++){XtSetArg(al[ae],XmNx,120);ae++;XtSetArg(al[ae],XmNy,i*30+10);ae++;edit[i] = XtCreateWidget(editors[i],

xmTextWidgetClass,bb, aI, ae);

/* XtAddCallbaek(edit[i], XmNmotionVerifyCallbaek,e_enter,

*/}

for(i=O; i < XtNumber(labels); i++){XtSetArg(al[ae],XmNx,10);ae++;XtSetArg(al[ae],XmNy,i*30+10);ae++;label[i] = XtCreateWidget(labels[i],

xmLabelWidgetClass,bb, aI, ae);

}

/* Set up the GO Pushbutton and the quit button */

39

Page 47: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

XtSetArg(al[ac] ,XmNx,30)jac++jXtSetArg(al[ac],XmNy,i*30+10)jac++jbutton[O] = XtCreateWidget(IQUIT",

xmPushButtonWidgetClass,bb, aI, ac) j

XtAddCallback(button[O], XmNactivateCallback,the_end, NULL)j

XtSetArg(al[ac],XmNx,130);ac++;XtSetArg(al[ac],XmNy,i*30+10);ac++;button[l] = XtCreateWidget(IGO",

xmPushButtonWidgetClass,bb, aI, ac);

XtAddCallback(button[l], XmNactivateCallback,calculate, NULL);

XtManageChildren(edit, XtNumber(editors))jXtManageChildren(label, XtNumber(buttons));

1* Manage buttons *1XtManageChildren(button, 2)j

XtRealizeWidget(toplevel)jXtMainLoop 0 ;

}

void get_text(w, textwidget, call_value)Widget w;Widget textwidget;XmAnyCallbackStruct *call_value;

{

printf("retrieving text: Yos\n", XmTextGetString(textwidget));}

void the_end(w, flag, call_data)Widget w;int *flagjXmAnyCallbackStruct *call_data;

{

XtCloseDisplay(XtDisplay(w))j

40

Page 48: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

exit(O);}

void calculate(w, flag, call_data)Widget w;int *flag;XmAnyCallbackStruct *call_data;

{

rcs19(&fstop,&fstrt,&nfreq,&thstrt,&thstop,&nangle,name,&len,strlen(name));

printf(ICalculating\n");}

41

Page 49: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Appendix C

Calling Fortran from C

\begin{verbatim}#include<stdio.h>#include<string.h>

char name [] =tltest 1ab tl ;

mainO{

float fstop,fstrt,thstrt,thstop,dc,dr;int len,itarg,nangle,nfreq;

itarg = 1;I*target(itarg,dc,dr);*1fstrt=8;fstop=12;nfreq=100;thstrt=O;thstop=89;nangle=90;

len=strlen(name);

rcs19(&fstop,&fstrt,&nfreq,&thstrt,&thstop,&nangle,name,&len,strlen(name));

printf(tlfinished!\ntl );

}

42

Page 50: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Appendix D

Rcs19f.f

C Author: H.F. SCHLUPER

C PROGRAM RCS19

SUBROUTINE RCS19(FSTOP,FSTRT,NFREQ,THSTRT,THSTOP,NANGLE,NAME,NCH)C This program creates a data file that contains frequencyC domain (range) VB. aspect angle data for a target consistingC of point scatterers.

COMPLEX MEASRD(1025),RESPNS

INCLUDE 'EXT.INC'CHARACTER NAME*40,DAT*9,TIM*8,COMENT*80REAL FSTOP,FSTRT,THSTRT,THSTOPINTEGER NFREQ,NANGLE,NCH

COMENT(1:80)=' ,C CALL COPYRIGHT('RCS19I ','1.21')C TYPE *C TYPE *,C *'This program simulates the output of the HP 8510 for radar'C TYPE *,'imaging.'C TYPE *,'It creates a file of RCS vs. frequency and asp. angle.'C TYPE *,'A number of scatterer configurations are predefined;'C TYPE *,'with target number 0 a configuration can be set up.'C TYPE *

PI=3.141592654C=2.9979E8C TYPE *,'Enter target number .,C READ(*,*) ITARG

43

Page 51: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

C

C Moet rechtsreeks vanuit de callback van Motif worden aangeroepenC

ITARG=1CALL TARGET(ITARG.DC.DR)C

C TYPE *C TYPE *.'Enter start and stop frequency in GHz:'C READ(*.*) FSTRT.FSTOPFSTRT=FSTRT*1.E9FSTOP=FSTOP*1.E9FO=.5*(FSTRT+FSTOP)B=FSTOP-FSTRT

C TYPE *.'Enter number of frequencies:'C READ(*.*) NFREQIF (NFREQ .EQ. 1) THEN

FSTEP=O.ELSE

FSTEP=(FSTOP-FSTRT)/(NFREQ-1)END IF

C TYPE *.'Enter start.stop angle in degrees:'C READ(*.*) THSTRT.THSTOP

C TYPE *C TYPE *.'Enter number of angles:'C READ(*.*) NANGLE

THSPAN=THSTOP-THSTRTIF (NANGLE .EQ. 1) THEN

THSTEP=O.ELSE

THSTEP=THSPAN/(NANGLE-1)END IF

C TYPE *.C * 'Enter the name of output file (without extension):'C CALL READQ(NAME.40.NCH)

NAME=NAME(1:NCH)//EXTREPOPEN(UNIT=1.STATUS='UNKNOWN'.FILE=NAME)

44

Page 52: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

C Write page 1-4 of directory to file .REPWRITE(1,100) CHAR(12)WRITE(1,100) CHAR(12)WRITE(1,100) CHAR(12)100 FORMAT(A1)

NAME=NAME(1:NCH)IIEXTRCSCALL RPHEAD(1,.FALSE.,NAME,DAT,TIM,COMENT,O,1,1)

WRITE(1,140) 'SIMULATION'140 FORMAT(A10)WRITE(1,600)600 FORMATO

WRITE(1,600)DO 1=1,3

CALL RPAXI S(1 , . FALSE. , , UNUSED I ' ,0. DO, 0 .DO , , I ' ,0, , I ' , , I ' )END DOCALL RPAXIS(1,.FALSE.,'ASP. ANGLEI',DBLE(THSTRT),

* DBLE(THSTOP),'degrl',NANGLE,'EQUII','I')WRITE(1,600)CALL RPAXIS(1,.FALSE.,'FREQUENCYI',DBLE(FSTRT),

* DBLE(FSTOP),'Hzl',NFREQ,'CMPLX','sml')CLOSE(UNIT=1)

OPEN(UNIT=2,FILE=NAME,STATUS='UNKNOWN',ACCESS='DIRECT',RECL=*4*2*NFREQ)

TYPE 160,NANGLE160 FORMAT(' Counting to ',14,' ... ',/)DO IANGLE=1,NANGLE

THETA=THSTRT+(IANGLE-1)*THSTEPTYPE 170,IANGLE

170 FORMAT('+',I4)THETA=THETA*PI/180.ST=SIN(THETA)CT=COS(THETA)

DO I=1,NFREQFREQ=FSTRT+(I-1)*FSTEPMEASRD(I) =RESPNS(FREQ, ST,CT)

END DOWRITE(2,REC=IANGLE) (MEASRD(I),I=1,NFREQ)

45

Page 53: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Appendix E

Overview of programming environments forPresentation-Manager and XII (Motif).

There are several possibilities to unify the Presentation Manager and the X Windowsprogramming environment, here is a list with the options we have:

1. XVT (Advanced Programming Institute)2. Aspect (Open Incorparated)3. Open Interface (Neuron Data)4. GKS5. matlab6. custom interface7. two separate interfaces

The first three possibilities are Application Programming Interfaces (API's), which unifyPM and XII.

E.! XVT

Price: approx. $ 500 per platform (runtime-licence requirement unknown).

Advantages:

• The product offers the programmer a programming interface which is identical forXlI and PM, this means that a single version of the program can be written andmaintained.

• The product has been on the market for a while.• There are a number of manufacturers who support XVT. (for instance Desqview

and Unisys)

Disadvantages:

• The product represents the largest common denominator of MS-windows, MAC,PM and XII.

• The product was originally designed for Macintosh and MS-Windows, X supportwas added later.

• Sources not available.

47

Page 54: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

• No application generator available. (Application generators for X and PM can notbe used.)

E.2 Aspect

Price: unknown.

Advantages:

• The product offers the programmer a programming interface which is identical forXII and PM, this means that a single version of the program can be written andmaintained.

Disadvantages:

• Unknown company and unknown product: little guarantees for support III thefuture.

• Just recently available, probably not stable yet.• No application generator available. (Application generators for X and PM can not

be used.)

E.3 Open Interface

Price: $ 9000 - $ 12000 for development-kit (dependent of platform) $ 1000 for run-timeversion.

Advantages:

• The product offers the programmer a programming interface which is identical forXlI and PM, this means that a single version of the program can be written andmaintained.

• Includes an interactive interface builder with which the framework for an applica-tion can be built.

Disadvantages:

• Rather expensive.• The product represents the largest common denominator of MS-windows, MAC,

PM and XII. (It appears to be less restricted than XVT).

• Sources not available.

• Unknown company and unknown product: little guarantees for support III thefuture.

• Just recently available, probably not stable yet.

48

Page 55: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

E.4 GKS

Price: For XlI: Free

Advantages:

• It's a standard.

Disadvantages:

• No information on GKS for PM.• Perhaps a bit slow.• Only drawing functions (No windowing).• No 3D support, this means that it can not be used for the graphics.

E.5 Matlab

Price: ...

Advantages:

• Available for many platform.• Widespread use.• Easily extensible (also by user).• Contains mathematical routines.

Disadvantages:

• Matlab is designed for mathematical data processing and not for graphical datarepresentation.

• Windowing support not present, this means that this will have to be added.

E.6 Custom interfacePrice: x man-hours

Advantages:

• Only limited by the possibilities of XII and PM.• Contains only the features needed.• The interface would offer us a programming interface which is identical for XlI and

PM, this means that a single version of the program can be written and maintained.• Sources available.

Disadvantages:

• No application generator available. (Application generators for X and PM can notbe used.)

• Lots of work.• Needs maintenance.• Reinventing the wheel.

49

Page 56: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

E.7 Two seperate interfaces

I.e. Write a framework for Xll and write a framework (the user interface) for PM. Thesepieces are system dependent, the remaining application code is system independent.

Price: x man-hours.

Advantages:

• Use of application generator is possible. (If each windowing-system contains anapplication generator.)

• Applications get the look & feel of the windowing-system.• No restriction in use of system and windowing environments specific features.

Disadvantages:

• Framework must be generated twice.• There are two versions of the programs which must be maintained.• Probably much extra work.

50

Page 57: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

Appendix F

Table ­Geometry'Management Widget for the X Toolkit

David HarrisonVC Berkeley Electronics Research Lab

([email protected], ... !ucbvax!ucbcad!davidh)

Table is a composite widget designed to manage the size and location of its children. The widgetuses an array model to simplify the arrangement of child widgets. The widget is directly derived fromthe core and composite widgets provided by the X Toolkit and can be used with any widget set. It hasbeen tested using the Athena widget set. Below is a short summary on the operation and use of theTable widget. It assumes a working knowledge of the X Toolkit Intrinsics.

The Table widget addresses formatting for dialog boxes. Dialog boxes are rectangular windows thatcontain a wide variety of widgets. Most dialog boxes are arranged with widgets aligned in a way similarto the layout found in business forms. The Table widget is designed to make such layouts easy to specify.

When designing dialog boxes that resemble business forms, the primary problem is specifying thealignment between widgets. The Table widget addresses this problem by adopting an array model.Under this model, widgets are placed at row and column locations in a variable sized array. Widgetsmay span more than one row or column. The array can expand or contract in size as needed. There areoptions to control justification and place size restrictions on rows and columns of widgets.

The Table widget can contain any number and type of sub-widgets (including other Table widgets).XtCreateWidget() is used to create new Table widgets using the class variabletableWidgetClass. The resources listed below arl! retrieved from the argument list or from the re­source database:

tableWidgetClassName Type Pefault Description

Xtlbackground Pixel XtDefaultBackground Window backgroundXtlborder Pixel XtDefaultForeground Window borderXtiborderWidth Dimension 0 Width of borderXtlx Position 0 X position of tableXtly Position 0 Y position of tableXtlvidth Dimension (computed at realize) Width of formXtlheight DimensiolJ (computed at realize) Height of formXtlmappedWhenManaged Boolean True XtMapWidget is automaticXtlsensitive Boolean True Widget receives inputXtllayout Layout None See textXtlinternalHeight Dimension 0 Int. horizontal paddingXtiinternalWidth Dimension 0 Int. vertical paddingXticolwanSpacing Dimension 0 Inter-column paddingXtiro.Spacing Dimension 0 Inter-row paddingXtldefaultOptions Options None See text

Widgets are added to a Table by specifying a Table widget as the parent widget when the widget iscreated. Once a widget is added to a table, it can be assigned a row and column position, a horizontaland vertical span, and justification options. This information can be specified in two ways: using publicaccess functions or using the resource database.

Public access functions allow the programmer to dynamically alter the formatting of children of aTable widget. One can alter the position, span, or options of a widget using XtTblConfig():

Page 58: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

void XtTblConfig(Widget v,Position col,Position rov,Dimension h_span,Dimension v_span,XtTblMask opt

) ;

/* Subvidget to modify *//* Column position (horizontal) *//* Rov position (vertical) *//* Bov many columns to span *//* Bov many rovs to span *//* Justification options */

The specified widget (which must be a child of a Table widget) will be placed at column 'col' androw 'rov'. The widget will span 'h_span' columns to the right of 'col' and 'v_span' rows below 'rov'.The array for the table will expand as necessary. Options are specified by 'or'ing together the followingoption bits:

TBL_LEFTTBL_RIGBTTBL_TOPTBL_BOTTOMTBL_LlCWIDTBTBL_UCBEIGBTTBL_SM_WIDTBTBL_SM_BEIGBT

Horizontally left justified.Horizontally right justified.Vertically top justified.Vertically bottom justified.Don't try to expand the widget horizontally.Don't try to expand the widget vertically.Force the width to be as small as possible.Force the height to be as small as possible.

/* Child of table vidget *//* Column position (horizontal) *//* Rov position (vertical) */

Alternatively, if 'options' is equal to TBL_DEF_OPT, the options are set to the default options for theTable widget. The default options for the Table widget are set using the XtidefaultOptions resource(see resource specifications below). The routine changes the formatting information in its internal table.If the Table widget is realized, the positions of all child widgets are recomputed and the change on thescreen will be immediate.

The Table widget computes the size of a widget based on the minimum size required for the row(s)and column(s) it occupies. However, some widgets may require less space than that computed by theTable widget. In this case, (he widget is aligned in the larger space according to the bits TBL_LEFT,TBL_RIGHT, TBL_TOP, and TBL_BOTTOM. These bits maybe combined (Le. TBL_RIGBTITBL_TOP specifiesupper right hand corner justification). If no justification bits are specified, the widget is centered.

Some widgets may be amenable to growing to any size specified by the Table widget. Often, it may bedesirable to force these widgets to remain at their optimal size for asthetic or operational convenienc·e.If the TBL_LICWIDTB bit is specified, the Table widget will not make the widget any wider than it'soriginal desired size. Similarly, if the TBL_LICBEIGBT bit is specified, the Table widget will not makethe widget any taller than it's original size. Note this may bring widget justification into play.

When a Table widget is resized, it automatically recomputes the sizes of the rows and columns ofan array and distributes extra space evenly among the rows and columns. Often, it may be useful tocontrol this distribution of space so that some rows or columns are not resized when extra space becomesavailable. If the TBL_SM_WIDTB bit is specified, the entire column(s) containing the widget are excludedfrom the excess space distribution algorithm. Thus, the column(s) are forced to remain as small aspossible. The TBL_SM_BEIGBT bit works the same way with respect to the row(s) containing the widget.A title bar is a good example of this concept. When a dialog is resized, any excess vertical space shouldbe given to the body of the dialog not to the title bar. Thus, TBL_SM_BEIGBT would be specified for atitle bar widget.

In most applications, the programmer will not set all of the above information for all widgets. Thefollowing convenience functions have been defined for use in these cases:

void XtTblPosition(Widget v,Position col,Position rov

) ;

The specified widget (which must be a child of a Table widget) will be placed at column 'col' androw 'rov'. The vertical and horizontal span of the widget will remain unchanged. If the span of the

Page 59: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

widget was not set, it will default to one row and one column. The justification options of the widget willremain unchanged. If the justification options of the widget were not set, it will default to TBL_DEF_OPT(see XtTblConfig(».

void ItTblResize(Vidget v.Dimension h_span,Dimention v_span

) ;

/* Child of table vidget/* Bov many columns to span/* Bov many rovs to span

/* Child of table vidget *//* Option mask */

This routine changes the span of widget 'v' (which must be a child of a Table widget) to span 'h_span'columns and 'v_span' rows. Any previous position or options assigned to the widget will be preserved.If no position is associated with the widget, it will be placed at (0,0). If no options are associated withthe widget, its options will be the defaults for the parent table widget.

void ItTblOptions(Vidget v.ItTblMask opt

) ;

This routine changes the option bits of widget 'v' (which must be a child of a Table widget) to 'opt'.The options ate as described for XtTblConfig(). Any associated position and span of the widget remainsunchanged. If the widget hasn't been placed, it will be located at (0,0) and given a span of (1, 1).

Layout information may also be specified using XtSetValues() or using the resource database. Theresources Itllayout and ItldefaultOptions may both be set in this fashion.

The Itllayout resource allows the user to specify the row, column, vertical span, horizontal span,and options for a set of widgets statically through the resource database or dynamically using XtSet­Values(). The type of this resource is private to the Table widget. However, the widget automaticallyregisters a type converter that converts between a string layout format and the internal form used bythe Table widget. This form is a list of statements separated by semicolons. Each statement has theform:

widget_namecolumnrovhorizontal_spanvertical_spanopt_list

Name of the widget as given to XtCreateWidget().Integer >= 0 giving column in arrayInteger >= 0 giving row in arrayInteger >= 1 giving number of columns to spanInteger >= 1 giving number of rows to spanSeries of characters each representing an option:

1: TBL_LEFTr: TBL_RIGHTt: TBL_TOPb: TBL_BOTTOMv: TBL_LK_VIDTBh: TBL_LK_BEIGHTV: TBL_SM_VIDTHB: TBL_SM_HEIGHT

The options are as described for XtTblConfig(). The horizontal_span, verticaLspan, andopt_list are optional and may be omitted. The horizontal and vertical spans will default to 1. Theoption list will default to the default options for the Table widget. A sample layout description is givenbelow:

"Title 0 0 2 1 B; First 0 1; Second 1 1"

When using XtSetValues() to specify the Xtllayout resource, the caller should use the followingfunction to parse a textual form into the internal form lised by the Table widget:

Page 60: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

caddr_t XtTblParseLayout(String layout

) ;

/* String layout specification */

This function parses 'layout' into an internal form that can be passed to a Table widget as theXtlUayout resource. The form of the layout is described above.

Unless otherwise specified, all options for widgets created under a Table widget are set based onthe default options for the Table widget. These default options are set using the XtHdefaultOptionsresource. This resource can be specified in the resource database as a string of option characters. Thisstring has the same form as the opt_list described above for XtTblParseLayout().

/** Table Widget Example - Using resources

** Place the folloving entries in your resources file:* TableExample.table.Layout: title 0 0 2 1 H; btl 0 1; bt2 1 1• TableExample*title.label: Title Bar• TableExample*btl.label: Button One* TableExample*bt2.label: Button Tvo*/

#include <Xll/StringDefs.h>#include <Xll/Intrinsic.h>#include <Xll/Shell.h>#include <Xll/Label.h>#include <Xll/Command.h>

#include "Table.h"

#de! ine MAX_ARGS#define APP_lAME

main(argc, argv)int argc;char *argv [] ;{

10"TableExample"

Widget initialize(), top, table, title, btl, bt2;irg arg_list[MAX_ARGS];int arg_len;

top = initialize(aargc, argv);ug_len =0;table =ItCreateManagedWidget("table", tableWidgetClaas,

top, arg_list, arg_len);title =XtCreateManagedWidget("title". labelWidgetClass,

table, arg_list, arg_len);btl = XtCreateManagedWidget("btl". commandWidgetClaas,

table, arg_list, arg_len);bt2 =XtCreateManagedWidget("bt2", commandWidgetClass,

table, arg_list, arg_len);XtRealizeWidget(top);XtMainLoopO;

}

Widget initialize(argc_p. argylint *argc_p;char *argv [] ;{

Page 61: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

}

Widget top;Display .disp;Arg arg_list[MAX_ARGS];int arg_len;

XtToolkitlnitialize();disp = XtOpenDisplay{(XtAppContext) O. 'II' argv [0]. APP_lAME.

(XrmOptionDescRec .) O. O. argc_p. argv);arg_len = 0;XtSetArg(arg_list[arg_len], XtlallowShellResize, True); arg_len++;top =XtAppCreateShell (argv [0] , APP_IAME, applicationShellWidgetClass,

disp, arg_list, arg_len);return top;

Page 62: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

/.• Table Widget Example - Direct Bpecification•• ThiB program createB one button for each Btring on the command• line. Try "ex2 ." to Bee all the fileB in the directory ../

'include <111/StringDefB.h>'include <111/IntrinBic.h>'include <111/Shell.h>'include <111/Label.h>.include <111/Command.h>

'include "Table.h"

'define MAI_ARGS'define APP_IAME'define IUM_ROWS

main(argc, argylint argc:char .argyD:{

10"TableExample"3

Widget initialize(), top, table, title, button:lrg arg_liBt[MAI_1RGS]:int arg_len, i, cols;

top = initialize(targc, argy);arg_len = 0;table =ItCreateManagedWidget(ltable", tableWidgetClass,

top, arg_liBt, arg_len):XtSetlrg(arg_list[arg_len], Itllabel, "Title Bar"); arg_len++;title =ItCreateManagedWidget("title", labelWidgetClass,

table, arg_list, arg_len):/. Each column viII haye three rovs ./cols = (argc-1)/IUM_ROWS + 1;XtTblConfig(title, 0, 0, cols, 1, TBL_SM_HEIGHT);for (i = 1; i < argc; i++) {

arg_len =0:ItSetlrg(arg_list[arg_len] , Itllabel, argy[i]); arg_len++:button =ItCreateKanagedWidget("button", commandWidgetClass,

table, arg_list, arg_len);if (i < argc-1) {

ItTblPosition(button, (i-1)/IUM_ROWS, (i-1)Y~UM_ROWS + 1):} else {

/. Last one spans to bottom ./ItTblConfig(button, (i-1)/IUM_ROWS, (i-1)YoIUM_ROWS + 1,

1, 3 - «i-1)YoIUM_ROWS), TBL_DEF_OPT):}

}

ItRealizeWidget(top);XtMainLoop();

}

Widget init ialize(argc_p , argylint .argc_p;char .argy 0 :

Page 63: Eindhoven University of Technology MASTER A new user ... · Abstract The Theoretical Electrotechnology group at the Eindhoven University of Technology uses a large software package

{

}

Widget top;Display .disp;Arg arg_list[MAX_ARGS];int arg_len;

XtToolkitlnitialize();disp = ItOpenDisplay«XtAppContext) 0, .... argv[O], APP_IAME.

(XrmOptionDescRec .) O. O. argc_p, argv);arg_len =0;XtSetArg(arg_list[arg_len]. ItlallovShellResize. True); arg_len++;top = XtAppCreateShell(argv[O]. APP_IAME. applicationShellWidgetClass.

disp. arg_list. arg_len);return top;