File: gcl_Xutil.lsp

package info (click to toggle)
gcl 2.6.7%2Bdfsga-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 84,796 kB
  • sloc: ansic: 452,686; lisp: 156,133; asm: 111,405; sh: 29,299; cpp: 18,599; perl: 5,602; makefile: 5,201; tcl: 3,181; sed: 469; yacc: 378; lex: 174; fortran: 48; awk: 30; csh: 23
file content (797 lines) | stat: -rw-r--r-- 15,632 bytes parent folder | download | duplicates (10)
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
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
(in-package :XLIB)
; Xutil.lsp      modified by Hiep Huu Nguyen                    27 Aug 92

; Copyright (c) 1994 Hiep Huu Nguyen and The University of Texas at Austin.

; See the files gnu.license and dec.copyright .

; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 1, or (at your option)
; any later version.

; This program 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 General Public License for more details.

; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

; Some of the files that interface to the Xlib are adapted from DEC/MIT files.
; See the file dec.copyright for details.

;; $XConsortium: Xutil.h,v 11.58 89/12/12 20:15:40 jim Exp $ */

;;**********************************************************
;;Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
;;and the Massachusetts Institute of Technology, Cambridge, Massachusetts.

;;modified by Hiep H Nguyen 28 Jul 91

;;                        All Rights Reserved

;;Permission to use, copy, modify, and distribute this software and its 
;;documentation for any purpose and without fee is hereby granted, 
;;provided that the above copyright notice appear in all copies and that
;;both that copyright notice and this permission notice appear in 
;;supporting documentation, and that the names of Digital or MIT not be
;;used in advertising or publicity pertaining to distribution of the
;;software without specific, written prior permission.  

;;DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
;;ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
;;DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
;;ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
;;WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
;;ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
;;SOFTWARE.

;;*****************************************************************

;; 
;; * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding)
;; * value (x, y, width, height) was found in the parsed string.)
 
(defconstant NoValue		0000)
(defconstant XValue  	0001)
(defconstant YValue		0002)
(defconstant WidthValue  	0004)
(defconstant HeightValue  	0008)
(defconstant AllValues 	15)
(defconstant XNegative 	16)
(defconstant YNegative 	32)

;;
 ;; The next block of definitions are for window manager properties that
 ;; clients and applications use for communication.
 

;; flags argument in size hints 
(defconstant USPosition	(expt 2  0) ) ;; user specified x, y 
(defconstant USSize		(expt 2  1) ) ;; user specified width, height 

(defconstant PPosition	(expt 2  2) ) ;; program specified position 
(defconstant PSize		(expt 2  3) ) ;; program specified size 
(defconstant PMinSize	(expt 2  4) ) ;; program specified minimum size 
(defconstant PMaxSize	(expt 2  5) ) ;; program specified maximum size 
(defconstant PResizeInc	(expt 2  6) ) ;; program specified resize increments 
(defconstant PAspect		(expt 2  7) ) ;; program specified min and max aspect ratios 
(defconstant PBaseSize	(expt 2  8) ) ;; program specified base for incrementing 
(defconstant PWinGravity	(expt 2  9) ) ;; program specified window gravity 

;; obsolete 
(defconstant PAllHints (+ PPosition PSize PMinSize PMaxSize PResizeInc PAspect))

;; definition for flags of XWMHints 

(defconstant InputHint 		(expt 2  0))
(defconstant StateHint 		(expt 2  1))
(defconstant IconPixmapHint		(expt 2  2))
(defconstant IconWindowHint		(expt 2  3))
(defconstant IconPositionHint 	(expt 2  4))
(defconstant IconMaskHint		(expt 2  5))
(defconstant WindowGroupHint		(expt 2  6))
(defconstant AllHints ( + InputHint StateHint IconPixmapHint IconWindowHint 
IconPositionHint IconMaskHint WindowGroupHint))

;; definitions for initial window state 
(defconstant WithdrawnState 0	) ;; for windows that are not mapped 
(defconstant NormalState 1	) ;; most applications want to start this way 
(defconstant IconicState 3	) ;; application wants to start as an icon 

;;
 ;; Obsolete states no longer defined by ICCCM
 
(defconstant DontCareState 0	) ;; don't know or care 
(defconstant ZoomState 2	) ;; application wants to start zoomed 
(defconstant InactiveState 4	) ;; application believes it is seldom used; 
			 ;; some wm's may put it on inactive menu 


 
;;
 ;; opaque reference to Region data type 
 
;;typedef struct _XRegion *Region; 

;; Return values from XRectInRegion() 
 
(defconstant RectangleOut 0)
(defconstant RectangleIn  1)
(defconstant RectanglePart 2)
 

(defconstant VisualNoMask		0)
(defconstant VisualIDMask 		1)
(defconstant VisualScreenMask	2)
(defconstant VisualDepthMask		4)
(defconstant VisualClassMask		8)
(defconstant VisualRedMaskMask	16)
(defconstant VisualGreenMaskMask	32)
(defconstant VisualBlueMaskMask	64)
(defconstant VisualColormapSizeMask	128)
(defconstant VisualBitsPerRGBMask	256)
(defconstant VisualAllMask		511)

(defconstant ReleaseByFreeingColormap 1) ;; for killid field above 


;;
;; return codes for XReadBitmapFile and XWriteBitmapFile
 
(defconstant BitmapSuccess		0)
(defconstant BitmapOpenFailed 	1)
(defconstant BitmapFileInvalid 	2)
(defconstant BitmapNoMemory		3)
;;
 ;; Declare the routines that don't return int.
 

;; ***************************************************************
;; *
;; * Context Management
;; *
;; ***************************************************************


;; Associative lookup table return codes 

(defconstant XCSUCCESS 0	) ;; No error. 
(defconstant XCNOMEM   1    ) ;; Out of memory 
(defconstant XCNOENT   2    ) ;; No entry in table 

;;typedef fixnum XContext;

(defentry XSaveContext(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum		;; context 
     fixnum 	;; data 

)( fixnum "XSaveContext"))



(defentry XFindContext(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum		;; context 
    fixnum 	;; data_return 

)( fixnum "XFindContext"))



(defentry XDeleteContext(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum		;; context 

)( fixnum "XDeleteContext"))




(defentry  XGetWMHints(

    fixnum 	;; display 
    fixnum		;; w 		      

)( fixnum  "XGetWMHints"))


(defentry XCreateRegion(

;;    void

)( fixnum "XCreateRegion"))


(defentry XPolygonRegion(

    fixnum 	;; points 
    fixnum			;; n 
    fixnum			;; fill_rule 

)( fixnum "XPolygonRegion"))



(defentry  XGetVisualInfo(

    fixnum 	;; display 
    fixnum		;; vinfo_mask 
    fixnum ;; vinfo_template 
    fixnum 	;; nitems_return 

)( fixnum  "XGetVisualInfo"))

;; Allocation routines for properties that may get longer 


(defentry  XAllocSizeHints (

;;    void

)( fixnum  "XAllocSizeHints" ))


(defentry  XAllocStandardColormap (

;;    void

)( fixnum  "XAllocStandardColormap" ))


(defentry  XAllocWMHints (

;;    void

)( fixnum  "XAllocWMHints" ))


(defentry  XAllocClassHint (

;;    void

)( fixnum  "XAllocClassHint" ))


(defentry  XAllocIconSize (

;;    void

)( fixnum  "XAllocIconSize" ))

;; ICCCM routines for data structures defined in this file 


(defentry XGetWMSizeHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints_return 
    fixnum 	;; supplied_return 
    fixnum		;; property 

)( fixnum "XGetWMSizeHints"))


(defentry XGetWMNormalHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints_return 
    fixnum 	;; supplied_return  

)( fixnum "XGetWMNormalHints"))


(defentry XGetRGBColormaps(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum  ;; stdcmap_return 
    fixnum 	;; count_return 
    fixnum		;; property 

)( fixnum "XGetRGBColormaps"))


(defentry XGetTextProperty(

    fixnum 	;; display 
    fixnum		;; window 
    fixnum ;; text_prop_return 
    fixnum		;; property 

)( fixnum "XGetTextProperty"))


(defentry XGetWMName(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop_return 

)( fixnum "XGetWMName"))


(defentry XGetWMIconName(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop_return 

)( fixnum "XGetWMIconName"))


(defentry XGetWMClientMachine(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop_return 

)( fixnum "XGetWMClientMachine"))


(defentry XSetWMProperties(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; window_name 
    fixnum ;; icon_name 
    fixnum 	;; argv 
    fixnum			;; argc 
    fixnum 	;; normal_hints 
    fixnum 	;; wm_hints 
    fixnum 	;; class_hints 

)( void "XSetWMProperties"))


(defentry XSetWMSizeHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints 
    fixnum		;; property 

)( void "XSetWMSizeHints"))


(defentry XSetWMNormalHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints 

)( void "XSetWMNormalHints"))


(defentry XSetRGBColormaps(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; stdcmaps 
    fixnum			;; count 
    fixnum		;; property 

)( void "XSetRGBColormaps"))


(defentry XSetTextProperty(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop 
    fixnum		;; property 

)( void "XSetTextProperty"))


(defentry XSetWMName(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop 

)( void "XSetWMName"))


(defentry XSetWMIconName(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop 

)( void "XSetWMIconName"))


(defentry XSetWMClientMachine(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; text_prop 

)( void "XSetWMClientMachine"))


(defentry XStringListToTextProperty(

    fixnum 	;; list 
    fixnum			;; count 
    fixnum ;; text_prop_return 

)( fixnum "XStringListToTextProperty"))


(defentry XTextPropertyToStringList(

    fixnum ;; text_prop 
    fixnum 		;; list_return 
    fixnum 	;; count_return 

)( fixnum "XTextPropertyToStringList"))

;; The following declarations are alphabetized. 



(defentry XClipBox(

    fixnum		;; r 
    fixnum 	;; rect_return 

)( void "XClipBox"))



(defentry XDestroyRegion(

    fixnum		;; r 

)( void "XDestroyRegion"))



(defentry XEmptyRegion(

    fixnum		;; r 

)( void "XEmptyRegion"))



(defentry XEqualRegion(

    fixnum		;; r1 
    fixnum		;; r2 

)( void "XEqualRegion"))



(defentry XGetClassHint(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; class_hints_return 

)( fixnum "XGetClassHint"))



(defentry XGetIconSizes(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 		;; size_list_return 
    fixnum 	;; count_return 

)( fixnum "XGetIconSizes"))



(defentry XGetNormalHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints_return 

)( fixnum "XGetNormalHints"))



(defentry XGetSizeHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints_return 
    fixnum		;; property 

)( fixnum "XGetSizeHints"))



(defentry XGetStandardColormap(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; colormap_return 
    fixnum		;; property 			    

)( fixnum "XGetStandardColormap"))



(defentry XGetZoomHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; zhints_return 

)( fixnum "XGetZoomHints"))



(defentry XIntersectRegion(

    fixnum		;; sra 
    fixnum		;; srb 
    fixnum		;; dr_return 

)( void "XIntersectRegion"))



(defentry XLookupString(

    fixnum 	;; event_struct 
    object		;; buffer_return 
    fixnum			;; bytes_buffer 
    fixnum 	;; keysym_return 
    fixnum ;; int_in_out 

)( fixnum "XLookupString"))



(defentry XMatchVisualInfo(

    fixnum 	;; display 
    fixnum			;; screen 
    fixnum			;; depth 
    fixnum			;; class 
    fixnum ;; vinfo_return 

)( fixnum "XMatchVisualInfo"))



(defentry XOffsetRegion(

    fixnum		;; r 
    fixnum			;; dx 
    fixnum			;; dy 

)( void "XOffsetRegion"))



(defentry XPointInRegion(

    fixnum		;; r 
    fixnum			;; x 
    fixnum			;; y 

)( fixnum "XPointInRegion"))



(defentry XRectInRegion(

    fixnum		;; r 
    fixnum			;; x 
    fixnum			;; y 
     fixnum	;; width 
     fixnum	;; height 

)( fixnum "XRectInRegion"))



(defentry XSetClassHint(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; class_hints 

)( void "XSetClassHint"))



(defentry XSetIconSizes(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; size_list 
    fixnum			;; count     

)( void "XSetIconSizes"))



(defentry XSetNormalHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints 

)( void "XSetNormalHints"))



(defentry XSetSizeHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; hints 
    fixnum		;; property 

)( void "XSetSizeHints"))



(defentry XSetStandardProperties(

    fixnum 	;; display 
    fixnum		;; w 
     object		;; window_name 
     object		;; icon_name 
    fixnum		;; icon_pixmap 
    fixnum 	;; argv 
    fixnum			;; argc 
    fixnum 	;; hints 

)( void "XSetStandardProperties"))



(defentry XSetWMHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; wm_hints 

)( void "XSetWMHints"))



(defentry XSetRegion(

    fixnum 	;; display 
    fixnum			;; gc 
    fixnum		;; r 

)( void "XSetRegion"))



(defentry XSetStandardColormap(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum ;; colormap 
    fixnum		;; property 

)( void "XSetStandardColormap"))



(defentry XSetZoomHints(

    fixnum 	;; display 
    fixnum		;; w 
    fixnum 	;; zhints 

)( void "XSetZoomHints"))



(defentry XShrinkRegion(

    fixnum		;; r 
    fixnum			;; dx 
    fixnum			;; dy 

)( void "XShrinkRegion"))



(defentry XSubtractRegion(

    fixnum		;; sra 
    fixnum		;; srb 
    fixnum		;; dr_return 

)( void "XSubtractRegion"))



(defentry XUnionRectWithRegion(

    fixnum 	;; rectangle 
    fixnum		;; src_region 
    fixnum		;; dest_region_return 

)( void "XUnionRectWithRegion"))



(defentry XUnionRegion(

    fixnum		;; sra 
    fixnum		;; srb 
    fixnum		;; dr_return 

)( void "XUnionRegion"))



(defentry XWMGeometry(

    fixnum 	;; display 
    fixnum			;; screen_number 
     object		;; user_geometry 
     object		;; default_geometry 
     fixnum	;; border_width 
    fixnum 	;; hints 
    fixnum 	;; x_return 
    fixnum 	;; y_return 
    fixnum 	;; width_return 
    fixnum 	;; height_return 
    fixnum 	;; gravity_return 

)( fixnum "XWMGeometry"))



(defentry XXorRegion(

    fixnum		;; sra 
    fixnum		;; srb 
    fixnum		;; dr_return 

)( void "XXorRegion"))
;;
 ;; These macros are used to give some sugar to the image routines so that
 ;; naive people are more comfortable with them.
 
(defentry XDestroyImage(fixnum) (fixnum "XDestroyImage"))
(defentry XGetPixel(fixnum fixnum fixnum) (fixnum "XGetPixel" ))
(defentry XPutPixel(fixnum fixnum int fixnum) ( fixnum "XPutPixel"))
(defentry XSubImage(fixnum  fixnum int fixnum fixnum) (fixnum  "XSubImage"))
(defentry XAddPixel(fixnum  fixnum) (fixnum  "XAddPixel"))
;;
 ;; Keysym macros, used on Keysyms to test for classes of symbols

(defentry IsKeypadKey(fixnum)  (fixnum "IsKeypadKey"))

(defentry IsCursorKey(fixnum) (fixnum "IsCursorKey"))

(defentry IsPFKey(fixnum) (fixnum "IsPFKey"))

(defentry  IsFunctionKey(fixnum) (fixnum "IsFunctionKey"))

(defentry IsMiscFunctionKey(fixnum)  (fixnum "IsMiscFunctionKey"))

(defentry IsModifierKey(fixnum) (fixnum "IsModifierKey"))
(defentry XUniqueContext() (fixnum  "XUniqueContext"))
(defentry  XStringToContext(object) (fixnum  "XStringToContext"))