File: ml_bind.ML

package info (click to toggle)
polyml 5.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 40,616 kB
  • sloc: cpp: 44,142; ansic: 26,963; sh: 22,002; asm: 13,486; makefile: 602; exp: 525; python: 253; awk: 91
file content (699 lines) | stat: -rw-r--r-- 29,799 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
(*
    Copyright (c) 2000
        Cambridge University Technical Services Limited

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
    
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*)

structure Motif: MOTIF_SIG =
struct

open MotifTypes;
open XmTypes;
open MotifCore;

local
  open XWindows;
  open XCall;
  open InitialiseCore;
in
    
(******************************************************************************)
(*                                                                            *)
(*      A few Xt operations                                                   *)
(*                                                                            *)
(******************************************************************************)
  val NoWidget:Widget = xcall (XCALL_NoWidget,0);
  
  fun WidgetID     (w:Widget):int  = xcall (XCALL_GetID,w);
  fun WidgetExists (w:Widget):bool = xcall (XCALL_ResourceExists,w);

  fun XtParseTranslationTable (s:string):XtTranslations =
    xcall (XCALL_XtParseTranslationTable,s);
  
  fun XtOverrideTranslations (w:Widget) (t:XtTranslations):unit =
    xcall (XCALL_XtOverrideTranslations,w,t);
  
  fun XtAugmentTranslations (w:Widget) (t:XtTranslations):unit =
    xcall (XCALL_XtAugmentTranslations,w,t);
  
  fun XtUninstallTranslations (w:Widget):unit =
    xcall (XCALL_XtUninstallTranslations,w);

(* SPF 14/2/94 not currently supported by run-time ...    
  fun XtTranslateTablePrint (t:XtTranslations):unit =
    xcall (XCALL_XtTranslateTablePrint,t);
... *)
  fun XtTranslateTablePrint (t:XtTranslations):unit =
    raise XWindows "XtTranslateTablePrint: not supported";
    
  fun XtParent  (w:Widget):Widget   = xcall (XCALL_XtParent,w);
  fun XtWindow  (w:Widget):Drawable = xcall (XCALL_XtWindow,w);
  fun XtDisplay (w:Widget):Display  = xcall (XCALL_XtDisplay,w);
  fun XtName    (w:Widget):string   = xcall (XCALL_XtName,w);
    
  fun XtAppInitialise  (D:string)
                       (A:string)
                       (C:string)
                       (F:string list)
                       (L:Arg list):Widget =
  let
    val shell   = xcall (XCALL_AppInitialise,D,A,C,F,XtSetExnVals L);
    val display = XtDisplay shell;
  in
    XStartDisplayHandler display;
    shell
  end;
  
  fun XtCreatePopupShell (name:string)
                         (parent:Widget)
                         (L:Arg list):Widget =
    xcall (XCALL_XtCreatePopupShell,name,parent,XtSetExnVals L);
  
  fun XtRealizeWidget   (w:Widget):unit = xcall (XCALL_XtRealizeWidget,w);
  fun XtUnrealizeWidget (w:Widget):unit = xcall (XCALL_XtUnrealizeWidget,w);
  fun XtDestroyWidget   (w:Widget):unit = xcall (XCALL_XtDestroyWidget,w);
  
  fun XtManageChildren   (L:Widget list):unit =
    xcall (XCALL_XtManageChildren,L);
    
  fun XtUnmanageChildren (L:Widget list):unit =
    xcall (XCALL_XtUnmanageChildren,L);
    
  fun XtManageChild   w = XtManageChildren   [w];
  fun XtUnmanageChild w = XtUnmanageChildren [w];
    
  fun XtSetValues (w:Widget) (L:Arg list):unit =
    xcall (XCALL_XtSetValues,w,XtSetExnVals L);
    
  fun XtSetValue w a = XtSetValues w [a];
    
  fun XtGetValues w = map (XtGetValue w);
      
(******************************************************************************)
(*                                                                            *)
(*      A few more Xt operations (SPF 6/12/94, 19/1/95)                       *)
(*                                                                            *)
(******************************************************************************)

  datatype XtGrabKind =
    XtGrabNone
  | XtGrabNonexclusive
  | XtGrabExclusive;
  
  fun XtPopup (w: Widget) XtGrabNone         : unit = xcall (XCALL_XtPopup,w,0)
    | XtPopup (w: Widget) XtGrabNonexclusive : unit = xcall (XCALL_XtPopup,w,1)
    | XtPopup (w: Widget) XtGrabExclusive    : unit = xcall (XCALL_XtPopup,w,2);

  fun XtPopdown (w: Widget) : unit = 
    xcall (XCALL_XtPopdown,w);

  fun XtMapWidget (w: Widget) : unit =
    xcall (XCALL_XtMapWidget,w);

  fun XtUnmapWidget (w: Widget) : unit =
    xcall (XCALL_XtUnmapWidget,w);

  fun XtIsManaged (w:Widget):bool =
    xcall (XCALL_XtIsManaged,w);
    
  fun XtIsRealized (w:Widget):bool =
    xcall (XCALL_XtIsRealized,w);

(******************************************************************************)
(*                                                                            *)
(*      Motif Callbacks                                                       *)
(*                                                                            *)
(******************************************************************************)
  datatype XtCallback =
    XmNactivateCallback
  | XmNapplyCallback
  | XmNarmCallback
  | XmNbrowseSelectionCallback
  | XmNcancelCallback
  | XmNcascadingCallback
  | XmNcommandChangedCallback
  | XmNcommandEnteredCallback
  | XmNdecrementCallback
  | XmNdefaultActionCallback
  | XmNdestroyCallback
  | XmNdisarmCallback
  | XmNdragCallback
  | XmNentryCallback
  | XmNexposeCallback
  | XmNextendedSelectionCallback
  | XmNfocusCallback
  | XmNgainPrimaryCallback
  | XmNhelpCallback
  | XmNincrementCallback
  | XmNinputCallback
  | XmNlosePrimaryCallback
  | XmNlosingFocusCallback
  | XmNmapCallback
  | XmNmessageCallback            (* this callback gets Message XEvents only *)
  | XmNmodifyVerifyCallback
  | XmNmotionVerifyCallback
  | XmNmultipleSelectionCallback
  | XmNnoMatchCallback
  | XmNokCallback
  | XmNpageDecrementCallback
  | XmNpageIncrementCallback
  | XmNpopdownCallback
  | XmNpopupCallback
  | XmNresizeCallback
  | XmNsimpleCallback
  | XmNsingleSelectionCallback
  | XmNtoBottomCallback
  | XmNtoTopCallback
  | XmNunmapCallback
  | XmNvalueChangedCallback;
  
  local
    fun Name XmNactivateCallback           = "activateCallback"
    |   Name XmNapplyCallback              = "applyCallback"
    |   Name XmNarmCallback                = "armCallback"
    |   Name XmNbrowseSelectionCallback    = "browseSelectionCallback"
    |   Name XmNcancelCallback             = "cancelCallback"
    |   Name XmNcascadingCallback          = "cascadingCallback"
    |   Name XmNcommandChangedCallback     = "commandChangedCallback"
    |   Name XmNcommandEnteredCallback     = "commandEnteredCallback"
    |   Name XmNdecrementCallback          = "decrementCallback"
    |   Name XmNdefaultActionCallback      = "defaultActionCallback"
    |   Name XmNdestroyCallback            = "destroyCallback"
    |   Name XmNdisarmCallback             = "disarmCallback"
    |   Name XmNdragCallback               = "dragCallback"
    |   Name XmNentryCallback              = "entryCallback"
    |   Name XmNexposeCallback             = "exposeCallback"
    |   Name XmNextendedSelectionCallback  = "extendedSelectionCallback"
    |   Name XmNfocusCallback              = "focusCallback"
    |   Name XmNgainPrimaryCallback        = "gainPrimaryCallback"
    |   Name XmNhelpCallback               = "helpCallback"
    |   Name XmNincrementCallback          = "incrementCallback"
    |   Name XmNinputCallback              = "inputCallback"
    |   Name XmNlosePrimaryCallback        = "losePrimaryCallback"
    |   Name XmNlosingFocusCallback        = "losingFocusCallback"
    |   Name XmNmapCallback                = "mapCallback"
    |   Name XmNmessageCallback            = "messageCallback"
    |   Name XmNmodifyVerifyCallback       = "modifyVerifyCallback"
    |   Name XmNmotionVerifyCallback       = "motionVerifyCallback"
    |   Name XmNmultipleSelectionCallback  = "multipleSelectionCallback"
    |   Name XmNnoMatchCallback            = "noMatchCallback"
    |   Name XmNokCallback                 = "okCallback"
    |   Name XmNpageDecrementCallback      = "pageDecrementCallback"
    |   Name XmNpageIncrementCallback      = "pageIncrementCallback"
    |   Name XmNpopdownCallback            = "popdownCallback"
    |   Name XmNpopupCallback              = "popupCallback"
    |   Name XmNresizeCallback             = "resizeCallback"
    |   Name XmNsimpleCallback             = "simpleCallback"
    |   Name XmNsingleSelectionCallback    = "singleSelectionCallback"
    |   Name XmNtoBottomCallback           = "toBottomCallback"
    |   Name XmNtoTopCallback              = "toTopCallback"
    |   Name XmNunmapCallback              = "unmapCallback"
    |   Name XmNvalueChangedCallback       = "valueChangedCallback";
  in  
    fun XtSetCallbacks (w:Widget) (L:(XtCallback * (Widget * 'a XEvent * '_b -> '_b)) list) (initialState:'_b) =
    let
      fun NameCallbacks []         = [] 
      |   NameCallbacks ((c,f)::T) = (Name c,f) :: NameCallbacks T;
      
      datatype 'a option = None | Some of 'a;
      
      fun FindMessageCallback []                          = None
      |   FindMessageCallback ((XmNmessageCallback,f)::_) = Some f 
      |   FindMessageCallback (_::T)                      = FindMessageCallback T;
      
      val M = FindMessageCallback L;
    in
    xcall (XCALL_SetCallbacks,w,NameCallbacks L,initialState);
      
      fn (ms:int) => fn (alpha:'a) =>
        case M of
          Some f => xcall (XCALL_InsertWidgetTimeout,w,ms,alpha,f)
        | None   => ()
    end;
  end;
    
  fun XtSetSensitive (w:Widget) (s:bool):unit =
    xcall (XCALL_XtSetSensitive,w,s);
    
  fun XtIsSensitive (w:Widget):bool =
    xcall (XCALL_XtIsSensitive,w);
  
(******************************************************************************)
(*                                                                            *)
(*      Motif Widget Creation Routines                                        *)
(*                                                                            *)
(******************************************************************************)
  local
    fun CreateXm (n:int)
                 (p:Widget)
                 (s:string)
                 (L:Arg list):Widget =
      xcall (n,p,s,XtSetExnVals L);
  in
    val XmCreateArrowButton         = CreateXm XCALL_XmCreateArrowButton;
    val XmCreateArrowButtonGadget   = CreateXm XCALL_XmCreateArrowButtonGadget;
    val XmCreateBulletinBoard       = CreateXm XCALL_XmCreateBulletinBoard;
    val XmCreateBulletinBoardDialog = CreateXm XCALL_XmCreateBulletinBoardDialog;
    val XmCreateCascadeButton       = CreateXm XCALL_XmCreateCascadeButton;
    val XmCreateCascadeButtonGadget = CreateXm XCALL_XmCreateCascadeButtonGadget;
    val XmCreateCommand             = CreateXm XCALL_XmCreateCommand;
    val XmCreateDialogShell         = CreateXm XCALL_XmCreateDialogShell;
    val XmCreateDrawingArea         = CreateXm XCALL_XmCreateDrawingArea;
    val XmCreateDrawnButton         = CreateXm XCALL_XmCreateDrawnButton;
    val XmCreateErrorDialog         = CreateXm XCALL_XmCreateErrorDialog;
    val XmCreateFileSelectionBox    = CreateXm XCALL_XmCreateFileSelectionBox;
    val XmCreateFileSelectionDialog = CreateXm XCALL_XmCreateFileSelectionDialog;
    val XmCreateForm                = CreateXm XCALL_XmCreateForm;
    val XmCreateFormDialog          = CreateXm XCALL_XmCreateFormDialog;
    val XmCreateFrame               = CreateXm XCALL_XmCreateFrame;
    val XmCreateInformationDialog   = CreateXm XCALL_XmCreateInformationDialog;
    val XmCreateLabel               = CreateXm XCALL_XmCreateLabel;
    val XmCreateLabelGadget         = CreateXm XCALL_XmCreateLabelGadget;
    val XmCreateList                = CreateXm XCALL_XmCreateList;
    val XmCreateMainWindow          = CreateXm XCALL_XmCreateMainWindow;
    val XmCreateMenuBar             = CreateXm XCALL_XmCreateMenuBar;
    val XmCreateMenuShell           = CreateXm XCALL_XmCreateMenuShell;
    val XmCreateMessageBox          = CreateXm XCALL_XmCreateMessageBox;
    val XmCreateMessageDialog       = CreateXm XCALL_XmCreateMessageDialog;
    val XmCreateOptionMenu          = CreateXm XCALL_XmCreateOptionMenu;
    val XmCreatePanedWindow         = CreateXm XCALL_XmCreatePanedWindow;
    val XmCreatePopupMenu           = CreateXm XCALL_XmCreatePopupMenu;
    val XmCreatePromptDialog        = CreateXm XCALL_XmCreatePromptDialog;
    val XmCreatePulldownMenu        = CreateXm XCALL_XmCreatePulldownMenu;
    val XmCreatePushButton          = CreateXm XCALL_XmCreatePushButton;
    val XmCreatePushButtonGadget    = CreateXm XCALL_XmCreatePushButtonGadget;
    val XmCreateQuestionDialog      = CreateXm XCALL_XmCreateQuestionDialog;
    val XmCreateRadioBox            = CreateXm XCALL_XmCreateRadioBox;
    val XmCreateRowColumn           = CreateXm XCALL_XmCreateRowColumn;
    val XmCreateScale               = CreateXm XCALL_XmCreateScale;
    val XmCreateScrollBar           = CreateXm XCALL_XmCreateScrollBar;
    val XmCreateScrolledList        = CreateXm XCALL_XmCreateScrolledList;
    val XmCreateScrolledText        = CreateXm XCALL_XmCreateScrolledText;
    val XmCreateScrolledWindow      = CreateXm XCALL_XmCreateScrolledWindow;
    val XmCreateSelectionBox        = CreateXm XCALL_XmCreateSelectionBox;
    val XmCreateSelectionDialog     = CreateXm XCALL_XmCreateSelectionDialog;
    val XmCreateSeparator           = CreateXm XCALL_XmCreateSeparator;
    val XmCreateSeparatorGadget     = CreateXm XCALL_XmCreateSeparatorGadget;
    val XmCreateSimpleCheckBox      = CreateXm XCALL_XmCreateSimpleCheckBox;
    val XmCreateSimpleMenuBar       = CreateXm XCALL_XmCreateSimpleMenuBar;
    val XmCreateSimpleOptionMenu    = CreateXm XCALL_XmCreateSimpleOptionMenu;
    val XmCreateSimplePopupMenu     = CreateXm XCALL_XmCreateSimplePopupMenu;
    val XmCreateSimplePulldownMenu  = CreateXm XCALL_XmCreateSimplePulldownMenu;
    val XmCreateSimpleRadioBox      = CreateXm XCALL_XmCreateSimpleRadioBox;
    val XmCreateText                = CreateXm XCALL_XmCreateText;
    val XmCreateTextField           = CreateXm XCALL_XmCreateTextField;
    val XmCreateToggleButton        = CreateXm XCALL_XmCreateToggleButton;
    val XmCreateToggleButtonGadget  = CreateXm XCALL_XmCreateToggleButtonGadget;
    val XmCreateWarningDialog       = CreateXm XCALL_XmCreateWarningDialog;
    val XmCreateWorkArea            = CreateXm XCALL_XmCreateWorkArea;
    val XmCreateWorkingDialog       = CreateXm XCALL_XmCreateWorkingDialog;
  end;
  
(******************************************************************************)
(*                                                                            *)
(*      Motif Widget Query Routines                                           *)
(*                                                                            *)
(******************************************************************************)
  fun XmIsArrowButton         (w:Widget):bool = xcall(XCALL_XmIsSomething, 1,w);
  fun XmIsArrowButtonGadget   (w:Widget):bool = xcall(XCALL_XmIsSomething, 2,w);
  fun XmIsBulletinBoard       (w:Widget):bool = xcall(XCALL_XmIsSomething, 3,w);
  fun XmIsCascadeButton       (w:Widget):bool = xcall(XCALL_XmIsSomething, 4,w);
  fun XmIsCascadeButtonGadget (w:Widget):bool = xcall(XCALL_XmIsSomething, 5,w);
  fun XmIsCommand             (w:Widget):bool = xcall(XCALL_XmIsSomething, 6,w);
  fun XmIsDesktopObject       (w:Widget):bool = xcall(XCALL_XmIsSomething, 7,w);
  fun XmIsDialogShell         (w:Widget):bool = xcall(XCALL_XmIsSomething, 8,w);
(* unsupported by solaris version of toolkit ...
  fun XmIsDisplayObject       (w:Widget):bool = xcall(XCALL_XmIsSomething, 9,w);
... *)
  fun XmIsDrawingArea         (w:Widget):bool = xcall(XCALL_XmIsSomething,10,w);
  fun XmIsDrawnButton         (w:Widget):bool = xcall(XCALL_XmIsSomething,11,w);
  fun XmIsExtObject           (w:Widget):bool = xcall(XCALL_XmIsSomething,12,w);
  fun XmIsFileSelectionBox    (w:Widget):bool = xcall(XCALL_XmIsSomething,13,w);
  fun XmIsForm                (w:Widget):bool = xcall(XCALL_XmIsSomething,14,w);
  fun XmIsFrame               (w:Widget):bool = xcall(XCALL_XmIsSomething,15,w);
  fun XmIsGadget              (w:Widget):bool = xcall(XCALL_XmIsSomething,16,w);
  fun XmIsLabel               (w:Widget):bool = xcall(XCALL_XmIsSomething,17,w);
  fun XmIsLabelGadget         (w:Widget):bool = xcall(XCALL_XmIsSomething,18,w);
  fun XmIsList                (w:Widget):bool = xcall(XCALL_XmIsSomething,19,w);
  fun XmIsMainWindow          (w:Widget):bool = xcall(XCALL_XmIsSomething,20,w);
  fun XmIsManager             (w:Widget):bool = xcall(XCALL_XmIsSomething,21,w);
  fun XmIsMenuShell           (w:Widget):bool = xcall(XCALL_XmIsSomething,22,w);
  fun XmIsMessageBox          (w:Widget):bool = xcall(XCALL_XmIsSomething,23,w);
  fun XmIsMotifWMRunning      (w:Widget):bool = xcall(XCALL_XmIsSomething,24,w);
  fun XmIsPanedWindow         (w:Widget):bool = xcall(XCALL_XmIsSomething,25,w);
  fun XmIsPrimitive           (w:Widget):bool = xcall(XCALL_XmIsSomething,26,w);
  fun XmIsPushButton          (w:Widget):bool = xcall(XCALL_XmIsSomething,27,w);
  fun XmIsPushButtonGadget    (w:Widget):bool = xcall(XCALL_XmIsSomething,28,w);
  fun XmIsRowColumn           (w:Widget):bool = xcall(XCALL_XmIsSomething,29,w);
  fun XmIsScale               (w:Widget):bool = xcall(XCALL_XmIsSomething,30,w);
(* unsupported by solaris version of toolkit ...
  fun XmIsScreenObject        (w:Widget):bool = xcall(XCALL_XmIsSomething,31,w);
... *)
  fun XmIsScrollBar           (w:Widget):bool = xcall(XCALL_XmIsSomething,32,w);
  fun XmIsScrolledWindow      (w:Widget):bool = xcall(XCALL_XmIsSomething,33,w);
  fun XmIsSelectionBox        (w:Widget):bool = xcall(XCALL_XmIsSomething,34,w);
  fun XmIsSeparator           (w:Widget):bool = xcall(XCALL_XmIsSomething,35,w);
  fun XmIsSeparatorGadget     (w:Widget):bool = xcall(XCALL_XmIsSomething,36,w);
  fun XmIsShellExt            (w:Widget):bool = xcall(XCALL_XmIsSomething,37,w);
  fun XmIsText                (w:Widget):bool = xcall(XCALL_XmIsSomething,38,w);
  fun XmIsTextField           (w:Widget):bool = xcall(XCALL_XmIsSomething,39,w);
  fun XmIsToggleButton        (w:Widget):bool = xcall(XCALL_XmIsSomething,40,w);
  fun XmIsToggleButtonGadget  (w:Widget):bool = xcall(XCALL_XmIsSomething,41,w);
  fun XmIsVendorShell         (w:Widget):bool = xcall(XCALL_XmIsSomething,42,w);
  fun XmIsVendorShellExt      (w:Widget):bool = xcall(XCALL_XmIsSomething,43,w);
(* Not supported in Motif 1.2
  fun XmIsWorldObject         (w:Widget):bool = xcall(XCALL_XmIsSomething,44,w);
*)


(******************************************************************************)
(*                                                                            *)
(*      Operations valid for specific Widget classes only                     *)
(*                                                                            *)
(******************************************************************************)  fun XmCascadeButtonHighlight (w:Widget) (b:bool):unit =
    xcall (XCALL_XmCascadeButtonHighlight,w,b);
  
  fun XmCommandError (w:Widget) (s:XmString):unit =
    xcall (XCALL_XmCommandError,w,s);

  fun XmCommandGetChild (w:Widget) (b:XmDefaultButtonType):Widget =
    xcall (XCALL_XmCommandGetChild,w,fromDefaultButtonType b);

  fun XmFileSelectionBoxGetChild (w:Widget) (b:XmDefaultButtonType):Widget =
    xcall (XCALL_XmFileSelectionBoxGetChild,w,fromDefaultButtonType b);
  
  fun XmFileSelectionDoSearch (w:Widget) (s:XmString):unit =
    xcall (XCALL_XmFileSelectionDoSearch,w,s);


  fun XmMainWindowSetAreas (a:Widget)
                           (b:Widget)
                           (c:Widget)
                           (d:Widget)
                           (e:Widget)
                           (f:Widget):unit =
    xcall (XCALL_XmMainWindowSetAreas,a,b,c,d,e,f);
  
  fun XmMainWindowSep1 (w:Widget):Widget = xcall (XCALL_XmMainWindowSepX,w,1);
  fun XmMainWindowSep2 (w:Widget):Widget = xcall (XCALL_XmMainWindowSepX,w,2);
  fun XmMainWindowSep3 (w:Widget):Widget = xcall (XCALL_XmMainWindowSepX,w,3);

  fun XmMessageBoxGetChild (w:Widget) (b:XmDefaultButtonType):Widget =
    xcall (XCALL_XmMessageBoxGetChild,w,fromDefaultButtonType b);
  
  fun XmOptionButtonGadget (w:Widget):Widget =
    xcall (XCALL_XmOptionButtonGadget,w);
    
  fun XmOptionLabelGadget  (w:Widget):Widget =
    xcall (XCALL_XmOptionLabelGadget,w);

  fun XmScrolledWindowSetAreas (a:Widget)
                               (b:Widget)
                               (c:Widget)
                               (d:Widget):unit =
    xcall (XCALL_XmScrolledWindowSetAreas,a,b,c,d);
  
  fun XmSelectionBoxGetChild (w:Widget) (b:XmDefaultButtonType):Widget =
    xcall (XCALL_XmSelectionBoxGetChild,w,fromDefaultButtonType b);
  
  fun XmSetMenuCursor (d:Display) (c:Cursor):unit =
    xcall (XCALL_XmSetMenuCursor,d,c);

  fun XmTrackingLocate (w:Widget) (c:Cursor) (b:bool):Widget =
    xcall (XCALL_XmTrackingLocate,w,c,b);
  
  fun XmUpdateDisplay (w:Widget):unit =
    xcall (XCALL_XmUpdateDisplay,w);
    
local
  type code = int;
  
  fun get (opn : code) : Widget -> '_a =
    fn (w:Widget) => xcall (opn,w);

  fun set (opn : code) : Widget -> '_a -> unit =
    fn (w:Widget) => fn(x:'_a) => xcall (opn,w,x);

  val getInt    : code -> Widget -> int = get;
  val getBool   : code -> Widget -> bool = get;
  val getString : code -> Widget -> string = get;

  val setInt    : code -> Widget -> int    -> unit = set;
  val setBool   : code -> Widget -> bool   -> unit = set;
  val setString : code -> Widget -> string -> unit = set;
in
(******************************************************************************)
(*                                                                            *)
(*      Operations on XmText Widgets                                          *)
(*                                                                            *)
(******************************************************************************)
 val XmTextGetAddMode =
    getBool XCALL_XmTextGetAddMode;

  val XmTextGetBaseline =
    getInt XCALL_XmTextGetBaseline;

  val XmTextGetCursorPosition =
    getInt XCALL_XmTextGetCursorPosition;

  val XmTextGetEditable =
    getBool XCALL_XmTextGetEditable;

  val XmTextGetInsertionPosition =
    getInt XCALL_XmTextGetInsertionPosition;

  val XmTextGetLastPosition =
    getInt XCALL_XmTextGetLastPosition;

  val XmTextGetMaxLength =
    getInt XCALL_XmTextGetMaxLength;

  val XmTextGetSelection =
    getInt XCALL_XmTextGetSelection;

  val XmTextGetString=
    getString XCALL_XmTextGetString;

  val XmTextGetTopCharacter =
    getInt XCALL_XmTextGetTopCharacter;

  fun XmTextInsert (w:Widget) (n:int) (s:string) : unit =
    xcall (XCALL_XmTextInsert,w,n,s);

  val XmTextPaste =
    getBool XCALL_XmTextPaste;

  val XmTextRemove =
    getBool XCALL_XmTextRemove;

  fun XmTextReplace (w:Widget) (from:int) (to:int) (s:string) : unit =
    xcall (XCALL_XmTextReplace,w,from,to,s);

  val XmTextScroll =
    setInt XCALL_XmTextScroll;

  val XmTextSetAddMode =
    setBool XCALL_XmTextSetAddMode;

  val XmTextSetCursorPosition =
    setInt XCALL_XmTextSetCursorPosition;

  val XmTextSetEditable =
    setBool XCALL_XmTextSetEditable;

  val XmTextSetInsertionPosition  =
    setInt XCALL_XmTextSetInsertionPosition;

  val XmTextSetMaxLength =
    setInt XCALL_XmTextSetMaxLength;

  val XmTextSetString =
    setString XCALL_XmTextSetString;

  val XmTextSetTopCharacter =
    setInt XCALL_XmTextSetTopCharacter;

  val XmTextShowPosition =
    setInt XCALL_XmTextShowPosition;

  fun XmTextXYToPos (w:Widget) (x:int) (y:int) : int =
    xcall (XCALL_XmTextXYToPos,w,x,y);
      
(******************************************************************************)
(*                                                                            *)
(*      Operations on XmTextField Widgets                                     *)
(*                                                                            *)
(******************************************************************************)
  val XmTextFieldGetAddMode =
    getBool XCALL_XmTextFieldGetAddMode;

  val XmTextFieldGetBaseline =
    getInt XCALL_XmTextFieldGetBaseline;

  val XmTextFieldGetCursorPosition =
    getInt XCALL_XmTextFieldGetCursorPosition;

  val XmTextFieldGetEditable =
    getBool XCALL_XmTextFieldGetEditable;

  val XmTextFieldGetInsertionPosition =
    getInt XCALL_XmTextFieldGetInsertionPosition;

  val XmTextFieldGetLastPosition =
    getInt XCALL_XmTextFieldGetLastPosition;

  val XmTextFieldGetMaxLength =
    getInt XCALL_XmTextFieldGetMaxLength;

  val XmTextFieldGetSelection =
    getInt XCALL_XmTextFieldGetSelection;

  val XmTextFieldGetString=
    getString XCALL_XmTextFieldGetString;

  fun XmTextFieldInsert (w:Widget) (n:int) (s:string) : unit =
    xcall (XCALL_XmTextFieldInsert,w,n,s);

  val XmTextFieldPaste =
    getBool XCALL_XmTextFieldPaste;

  val XmTextFieldRemove =
    getBool XCALL_XmTextFieldRemove;

  fun XmTextFieldReplace (w:Widget) (from:int) (to:int) (s:string) : unit =
    xcall (XCALL_XmTextFieldReplace,w,from,to,s);

  val XmTextFieldSetAddMode =
    setBool XCALL_XmTextFieldSetAddMode;

  val XmTextFieldSetCursorPosition =
    setInt XCALL_XmTextFieldSetCursorPosition;

  val XmTextFieldSetEditable =
    setBool XCALL_XmTextFieldSetEditable;

  val XmTextFieldSetInsertionPosition  =
    setInt XCALL_XmTextFieldSetInsertionPosition;

  val XmTextFieldSetMaxLength =
    setInt XCALL_XmTextFieldSetMaxLength;

  val XmTextFieldSetString =
    setString XCALL_XmTextFieldSetString;

  val XmTextFieldShowPosition =
    setInt XCALL_XmTextFieldShowPosition;

  fun XmTextFieldXYToPos (w:Widget) (x:int) (y:int) : int =
    xcall (XCALL_XmTextFieldXYToPos,w,x,y);
end; (* local *)
      
(******************************************************************************)
(*                                                                            *)
(*      Operations on XmList Widgets                                          *)
(*                                                                            *)
(******************************************************************************)

  fun XmListAddItem (w: Widget) (s:string) (pos:int) : unit =
    xcall (XCALL_XmListAddItem,w,s,pos);
   
  fun XmListAddItemUnselected (w: Widget) (s: string) (pos: int) : unit =
    xcall (XCALL_XmListAddItemUnselected,w,s,pos);
   
  fun XmListAddItems (w: Widget) (sl: string list) (pos: int) : unit =
    xcall (XCALL_XmListAddItems,w,sl,pos);
   
  fun XmListDeleteAllItems (w: Widget) : unit =
    xcall (XCALL_XmListDeleteAllItems,w);

  fun XmListDeleteItem (w: Widget) (s: string) : unit =
    xcall (XCALL_XmListDeleteItem,w,s);

  fun XmListDeleteItems (w: Widget) (sl: string list) : unit =
    xcall (XCALL_XmListDeleteItems,w,sl);

  fun XmListDeletePos (w: Widget) (pos: int) : unit =
    xcall (XCALL_XmListDeletePos,w,pos);

  fun XmListDeleteItemsPos (w: Widget) (num: int) (pos: int) : unit =
    xcall (XCALL_XmListDeleteItemsPos,w,num,pos);

  fun XmListDeselectAllItems (w: Widget) : unit =
    xcall (XCALL_XmListDeselectAllItems,w);

  fun XmListDeselectItem (w: Widget) (s: string) : unit =
    xcall (XCALL_XmListDeselectItem,w,s);

  fun XmListDeselectPos (w: Widget) (pos: int) : unit =
    xcall (XCALL_XmListDeselectPos,w,pos);

  fun XmListGetMatchPos (w: Widget) (s: string) : int list =
    xcall (XCALL_XmListGetMatchPos,w,s);

  fun XmListGetSelectedPos (w: Widget) : int list =
    xcall (XCALL_XmListGetSelectedPos,w);

  fun XmListItemExists (w: Widget) (s: string) : bool =
    xcall (XCALL_XmListItemExists,w,s);

  fun XmListItemPos (w: Widget) (s: string) : int =
    xcall (XCALL_XmListItemPos,w,s);

  fun XmListReplaceItems (w: Widget) (oldNewPairs : (string * string) list) : unit =
  let
    val oldStrings = map #1 oldNewPairs;
    val newStrings = map #2 oldNewPairs;
  in
    xcall (XCALL_XmListReplaceItems,w,oldStrings,newStrings)
  end;
    
  fun XmListReplaceItemsPos (w: Widget) (sl: string list) (pos: int) : unit =
    xcall (XCALL_XmListReplaceItemsPos,w,sl,pos);
  
  fun XmListSelectItem (w: Widget) (s: string) (notify: bool) : unit =
    xcall (XCALL_XmListSelectItem,w,s,notify);
  
  fun XmListSelectPos (w: Widget) (pos: int) (notify: bool) : unit =
    xcall (XCALL_XmListSelectPos,w,pos,notify);
  
  fun XmListSetAddMode (w: Widget) (on: bool) : unit =
    xcall (XCALL_XmListSetAddMode,w,on);
  
  fun XmListSetBottomItem (w: Widget) (s:string) : unit =
    xcall (XCALL_XmListSetBottomItem,w,s);
  
  fun XmListSetBottomPos (w: Widget) (pos:int) : unit =
    xcall (XCALL_XmListSetBottomPos,w,pos);
  
  fun XmListSetHorizPos (w: Widget) (pos:int) : unit =
    xcall (XCALL_XmListSetHorizPos,w,pos);

  fun XmListSetItem (w: Widget) (s:string) : unit =
    xcall (XCALL_XmListSetItem,w,s);
  
  fun XmListSetPos (w: Widget) (pos:int) : unit =
    xcall (XCALL_XmListSetPos,w,pos);
  
  fun XmMenuPosition (w: Widget) (ev: 'a XEvent): unit =
    case ev of
       ButtonPress { rootPointer=XPoint{x,y}, ...} =>
        xcall(XCALL_XmMenuPosition, w, x, y)
     | ButtonClick { rootPointer=XPoint{x,y}, ...} =>
        xcall(XCALL_XmMenuPosition, w, x, y)
     | _ => raise XWindows("Bad event type in XmMenuPosition")

end; (* local *)
end; (* struct *)