This file is indexed.

/usr/share/doc/gnat-gps/gps_pg.html is in gnat-gps-doc 5.0-16.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 2002-2010 AdaCore.

This document is free; 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 2 of the License, or
(at your option) any later version.

This document 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, see http://www.gnu.org/licenses/.

A copy of the license is included in the section entitled
"GNU General Public License". -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GPS Programmer&rsquo;s Guide</title>

<meta name="description" content="GPS Programmer&rsquo;s Guide">
<meta name="keywords" content="GPS Programmer&rsquo;s Guide">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="#Top" rel="start" title="Top">
<link href="#GNU-General-Public-License" rel="index" title="GNU General Public License">
<link href="dir.html#Top" rel="up" title="(dir)">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<h1 class="settitle" align="center">GPS Programmer&rsquo;s Guide</h1>





<a name="Top"></a>
<a name="GPS-Programmer_0027s-Guide"></a>
<h1 class="top">GPS Programmer&rsquo;s Guide</h1>

<p>Version 5.0.0
</p>
<p>Date: $Date: 2010-10-01 12:54:37 +0200 (Fri, 01 Oct 2010) $
</p>
<p>Copyright &copy; 2002-2010 AdaCore.
</p>
<p>This document is free; 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 2 of the License, or
(at your option) any later version.
</p>
<p>This document 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.
</p>
<p>You should have received a copy of the GNU General Public License along
with this program; if not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
</p>
<p>A copy of the license is included in the section entitled
&ldquo;GNU General Public License&rdquo;.
</p>



<hr>
<a name="Introduction"></a>
<a name="Introduction-1"></a>
<h2 class="chapter">1 Introduction</h2>

<p><b>Important note</b>: This document is not ready for release yet.
</p>

<p>This document explains how to add your own modules to the GPS programming
system.
</p>
<p>GPS is a fully open architecture, to which one can add new features ranging
from new menu items to launch external tools to full support for new languages,
including cross-references.
</p>
<a name="index-adding-menus"></a>
<a name="index-menus"></a>
<a name="index-toolbar"></a>
<a name="index-key-bindings"></a>

<p>Some of these additions can be done solely through the use of text
files. These are for instance adding new key bindings to various parts
of GPS, for instance in the editor. The end-user can also easily add new menus
or toolbar buttons. See the customization chapters in the GPS user&rsquo;s guide.
</p>
<p>This document will focus on these additions that can only be done
through programming languages.
</p>
<p>At this point, GPS can only be extended by programming in
<b>Ada</b>. In addition, it is planned for the near future that extensions
in <b>C</b> or <b>C++</b> can be done. Work is under way to extend python scripting
in GPS.
</p>
<p>Likewise, adding basic support for new languages will be made easier,
and doable through external text files, requiring no
programming. This is not available for this first release of the GPS
environment.
</p>
<hr>
<a name="System-Setup"></a>
<a name="System-Setup-1"></a>
<h2 class="chapter">2 System Setup</h2>

<p>As explained in the introduction, GPS can currently only be extended
by programming in Ada. This assumes that a number of tools are
available on your system, so that you can recompile your new module.
</p>
<p>Most of these external tools and libraries are available from
<a href="http://libre.act-europe.fr">http://libre.act-europe.fr</a>.
</p>
<dl compact="compact">
<dt><b>GNAT 3.15 or above</b></dt>
<dd><p>GNAT is the GNU Ada Compiler, integrated into the gcc tool chain, and
developed by <b>Ada Core Technologies</b> and <b>ACT Europe</b>. GPS will not compile
with other Ada compilers than GNAT.
</p>
</dd>
<dt><b>Gtk+ 2.2.0 or above</b></dt>
<dd><p>gtk+ is a C toolkit used for the graphical interface of GPS. It is
available on a number of platforms, including most UNIX systems and
Windows. Available from <a href="http://www.gtk.org">http://www.gtk.org</a>.
</p>
</dd>
<dt><b>GPS sources</b></dt>
<dd><p>The GPS sources include the corresponding GNAT, GtkAda and GVD sources
needed to build it. If needed, GNAT, GtkAda and GVD sources can be
obtained seperately from anonymous cvs access from
<a href="http://libre.act-europe.fr">http://libre.act-europe.fr</a>
</p>
</dd>
</dl>

<p>The GPS sources contain an INSTALL file that explains how to recompile
GPS itself. GPS knows how to dynamically load a module. As a result,
you do not necessarily need to rebuild GPS itself to add new modules,
although the dynamic loading hasn&rsquo;t been fully tested yet and might
not work on all platforms.
</p>
<hr>
<a name="The-GPS-modules"></a>
<a name="The-GPS-modules-1"></a>
<h2 class="chapter">3 The GPS modules</h2>

<p>GPS is organized around the concept of modules. The only part of GPS that
is mandatory is its kernel (see <a href="#The-GPS-Kernel">The GPS Kernel</a>), all the other tools,
menus and features are provided in optional modules.
</p>
<p>Although currently all modules have to be loaded at startup, some proof of
concept for dynamically loadable module was implemented, and will most likely
be part of a future version of GPS.
</p>
<p>Every new feature you implement will be part of one or more modules. We will
go through the details of creating new modules all along this manual, starting
from a simple Hello World module to more advanced features like providing
new shell or python commands.
</p>
<p>Generally speaking, a module provides a limited set of features, and adds
new GUI features in the GPS interface, like menus, toolbar buttons, contextual
menu entries, new windows,&hellip; As much as possible, a menu shouldn&rsquo;t directly
depend on any other module, only on the GPS kernel itself.
</p>
<p>See the file <samp>gps-kernel-modules.ads</samp> for more information on modules.
</p>

<hr>
<a name="Hello-World-Walk-Through"></a>
<a name="Hello-World-walk-through"></a>
<h2 class="chapter">4 Hello World walk through</h2>

<p>Creating a new module is best demonstrated by going through the
classical and simple example &ldquo;hello world&rdquo;. This example will be
refined as new extension possibilities are described later on in this
document.
</p>
<a name="Declaring-the-module"></a>
<h3 class="section">4.1 Declaring the module</h3>

<p>A module is generally implemented in a separate source file, at this point
an Ada package. The first thing that needs to be done is to create the specs
of this package. Most of the time, a single function has to be exported,
which is called Register_Module by convention. Therefore, we have to create
a new directory to contain the module (we&rsquo;ll call it <samp>hello_world</samp>), at
the same level as other modules like the source editor.
</p>
<p>Still by convention, the sources are put in a directory called <samp>src</samp>, and
the object files are kept in a separate directory called <samp>obj</samp>.
</p>
<div class="smallexample">
<pre class="smallexample">mkdir hello_world
mkdir hello_world/src
mkdir hello_world/obj
</pre></div>

<p>In the source directory, we create the file <samp>hello_world.ads</samp>, which
contains the declaration of the <code>Register_Module</code> subprogram.
</p>
<div class="smallexample">
<pre class="smallexample"><b>with</b> GPS.Kernel;
<b>package</b> Hello_World <b>is</b>
   <b>procedure</b> Register_Module
      (Kernel : <b>access</b> GPS.Kernel.Kernel_Handle_Record'Class);
<b>end</b> Hello_World;
</pre></div>

<p>Before going over the details of the implementation of <code>Register_Module</code>,
we have to make sure that the rest of GPS knows about this module, and that
we know how to compile it
</p>
<a name="Publicizing-your-module"></a>
<h3 class="section">4.2 Publicizing your module</h3>

<p>Until GPS provides dynamic modules, you have to modify the main subprogram of
GPS to make it aware of your module.
</p>
<p>This is done by modifying the file <samp>gps.adb</samp>, and adding two statements
in there: a <code>with</code> statement that imports <samp>hello_world</samp>.ads, and
a call to <code>Hello_World.Register_Module</code>. See for instance how this is
done for the keymanager module.
</p>
<a name="Compiling-your-module"></a>
<h3 class="section">4.3 Compiling your module</h3>

<p>However, after the addition of the two statements in <samp>gps.adb</samp>, the file
<samp>hello_world.ads</samp> will not be found automatically by GPS. Therefore,
you need to create a project file for your new module (we&rsquo;ll call it
<samp>hello_world.gpr</samp>), and add a dependency to it in the root project file
of GPS (<samp>gps/gps.gpr</samp>), as is currently done for all other modules.
</p>
<p>The project file <samp>hello_world.gpr</samp> is best created by copying the
project file from any other module, for instance the aliases module
(<samp>aliases/aliases.gpr</samp>), and changing the name of the project to
<code>Hello_World</code>.
</p>
<p>You must also create a set of two Makfiles, which are used to add files other
than Ada, even if your module only uses Ada files.
Once again, this is best done by copying the two Makefiles from the
directory <samp>aliases</samp>, renaming them into <samp>Makefile</samp> and
<samp>Makefile.hello_world</samp>, and replacing the strings <code>aliases</code> and
<code>ALIASES</code> by resp. <code>hello_world</code> and <code>HELLO_WORLD</code>.
</p>
<p>These steps will be made easier in the near future, but in any case are
relatively straightforward, and only need to be done once per module. The
resulting setup automatically takes into account all sources files that will
be added later on to the module, either C or Ada, and compile them with the
appropriate compiler.
</p>
<p>You might also prefer in your first attempt at creating a new module to add
your new files into the <samp>src</samp> directory of an existing module. In this
case, you don&rsquo;t have to create any of the project files or Makefile, nor to
modify the <samp>gps.adb</samp> file.
</p>
<p>Once the project file has been created, and a dependency added in
<samp>gps.gpr</samp>, you might want to reload the GPS project in GPS, so that the
editing of your sources can be done in an Ada-friendly context.
</p>
<a name="Registering-the-module"></a>
<h3 class="section">4.4 Registering the module</h3>

<p>Back to the source files of your modules. We now need to create a body for
the procedure <code>Register_Module</code>. The minimal thing this function has to
do is indicate to the GPS kernel that a new module is being declared, and
give it a name. If you only do that, there is no direct impact on the rest
of GPS. However, as we will see during in this guide, having a specific
<code>Module_Id</code> is mandatory for some of the advanced feature, so it is
cleaner to always declare one from the start.
</p>
<p>This is done by creating the file <samp>hello_world.adb</samp>, with the following
contents.
</p>
<div class="smallexample">
<pre class="smallexample"><b>with</b> GPS.Kernel.Modules;  <b>use</b> GPS.Kernel, GPS.Kernel.Modules;

<b>package</b> Hello_World <b>is</b>
   <b>procedure</b> Register_Module
      (Kernel : <b>access</b> GPS.Kernel.Kernel_Handle_Record'Class)
   <b>is</b>
      Module : Module_ID;
   <b>begin</b>
      GPS.Kernel.Modules.Register_Module
         (Module, Kernel, Module_Name =&gt; &quot;hello_world&quot;);
   <b>end</b> Register_Module;

<b>end</b> Hello_World;
</pre></div>

<p>At this point, the hello_world module is compilable, only it won&rsquo;t do anything
but be loaded in GPS.
</p>
<p>The following sections will show how new features can be provided to the
rest of GPS.
</p>


<hr>
<a name="The-GPS-Kernel"></a>
<a name="The-GPS-Kernel-1"></a>
<h2 class="chapter">5 The GPS Kernel</h2>



<hr>
<a name="Intermodule-communication"></a>
<a name="Intermodule-communication-1"></a>
<h2 class="chapter">6 Intermodule communication</h2>

<p>As described above, GPS is organized into largely independent
modules. For instance, the various views, browsers, help, vcs
support,... are separate modules, that can either be loaded at startup
or not.
</p>
<p>When they are not loaded, the correspondings features and menus are not
available to the user.
</p>
<p>These modules need to communicate with each other so as to provide the
best possible integration between the tools. There currently exists a
number of ways to send information from one module to
another. However, some of these technics depend on Ada-specific types,
and thus makes it harder to write modules in different languages like
C or Python.
</p>
<p>The following communication technics are currently provided:
</p>
<ul>
<li> Direct calls
A module can explicitly specify that it depends on another one. This
is done by changing the project file, and adding the necessary &quot;with&quot;
statements in the code.  This technics is highly not recommended, and
should never be used when one of the other technics would do the job,
since it defeats the module independency.  The only place it is
currently used at is for direct calls to the Register_* commands.
Most of the time, these Register_* subprograms are also available through
XML customization files, and thus limit the direct dependencies between
modules, while providing greated extensibility to the final user.

</li><li> Shell calls
Each module can register new shell commands for the interactive shell
window.  Any other module can call these commands. There is no direct
dependency on the code, although this means that the module that
provide the command must be loaded before the other module.  This
technics is used for instance for the codefix module, that needs a
high degree of integration with the source editor module. It will also
be used for communicating with Emacs.

</li><li> Addition to contextual menus
A module is free to add entries to the main menu bar or to any
contextual menus within GPS.

<p>Most of the time, a module will decide to add new entries depending on
what the contextual menu applies to (the current context), although it
might also decide to do that based on what module is displaying the
contextual menu. Modules are identified by their name, which can
easily be tested by other menus.
</p>
</li><li> Context changes
Every time a new MDI child is selected, or when a module chooses to
emit such a signal, a context change is reported via a gtk+ signal. A
context is an Ada tagged type, created by the currently active
module. There exists different kinds of contexts, some for files
(directories and project), others for entities (same as before, but
with an entity name in addition, other for a location (adding line and
column),...  New types of contexts can be created by the modules
without impacting the rest of GPS. All callbacks must test that the
context they receive matches what they can handle.

<p>These contexts are also used for the contextual menus
</p>
<p>A module can choose to emit the signal to report changes to its
context by emitting the signal. Other modules can they update their
content accordingly. This is how the switches editor updates the
project/directory/file it is showing when a new selection is done in
the project view.
</p>
</li><li> hooks and action hooks
Hooks are similar to the usual gtk+ signals.
Each hook is a named collection of subprograms to be called when the hook is
executed. Such hooks are executed by various parts of GPS when some actions
take place, like reloading the project, loading a file,&hellip;

<p>These are the most powerful way for a module to react to actions taking place
in other parts of GPS, and to act appropriately.
</p>
<p>In most cases, all the subprograms in a hook are executed in turn, and thus
they all get a chance to act.
</p>
<p>However, in some other cases, the subprograms are only executed until one of
them indicates that it has accomplished a useful action, and that no other
subprogram from this hook should be called. These are called <b>action hooks</b>.
This is the fundamental mechanism used by GPS to request for instance the
edition of a file: the module that wishes to display a file executes the
hook &quot;open_file_action_hook&quot; with the appropriate argument. At this point, all
subprograms bound to this hook are executed, until one of them acknowledge that
it knows how to edit this file (and hopefully opens an editor). Then no other
subprogram from this hook is called, so that the file is not open multiple
times.
</p>
<p>This mechanism is used for instance by the module that handles the external
editors. It is setup so that it binds to the &quot;open_file_action_hook&quot; hook. Any
time a file needs to be open, the callback from this module is called first.
If the user has indicated that the external editor should always be used, this
external editors module opens the appropriate editor, and stops the execution
of the hook. However, if the user didn&rsquo;t wish to use an external editor, this
module does nothing, so that the callback from the source editor module is
called in turn, and can thus open the file itself.
</p>
<p>See <samp>gps-kernel-hooks.ads</samp> for more information on hooks.
</p>
</li></ul>


<hr>
<a name="Documenting-your-module"></a>
<a name="Documenting-your-module-1"></a>
<h2 class="chapter">7 Documenting your module</h2>

<p>All modules should be documented, so that the users are aware of all
its capabilities.
</p>
<p>There are several levels of documentation:
</p>
<ul>
<li> Tooltips
It is recommended that all new preferences and as much of the GUI as
possible be documented through tooltips. This is the only help that
most users will read.

<p>Tooltips are easily added directly with gtk+: Just call
<code>Gtk.Tooltips.Set_Tooltip</code> with the appropriate parameters. The
kernel itself contains a tooltip group, which should be used when
setting new tooltips. This is so that a common timeout is used for all
tooltips in the application: when a user has waited long enough for
the first tooltip to be displayed, he won&rsquo;t have to wait again for the
other tooltips.
</p>
</li><li> extended documentation
Extended documentation should be written in HTML.
See the GPS user&rsquo;s guide on how to make new documentation available to
users.

</li></ul>

<hr>
<a name="Debugging"></a>
<a name="Debugging-1"></a>
<h2 class="chapter">8 Debugging</h2>

<a name="X11-server"></a>
<h3 class="section">8.1 X11 server</h3>

<p>If you are developing on a linux system, it is recommended that you
reconfigure your X11 server with the following setup (see the file
<samp>/etc/X11/XF86Config-4</samp>):
</p>
<div class="smallexample">
<pre class="smallexample">Section &quot;ServerFlags&quot;
        Option &quot;AllowDeactivateGrabs&quot; &quot;true&quot;   # Ctrl+Alt+Keypad *
        Option &quot;AllowClosedownGrabs&quot;  &quot;true&quot;   # Ctrl+Alt+Keypad /
EndSection
</pre></div>

<p>The two key bindings described above are used to release any grab that
a GUI application might have. This is especially useful when debugging
through <code>gdb</code>: it might happen that the breakpoint happens while
such a grab is in place, and would therefore prevent any input (mouse
or keyboard) to any application in your X11 session, in particular the
debugger.
</p>

<a name="gtk_002b-library"></a>
<h3 class="section">8.2 gtk+ library</h3>

<p>It is also recommended that you recompile your own gtk+ library (on
systems where this is easily doable such as Unix systems), with the
following configure command:
</p>
<div class="smallexample">
<pre class="smallexample">   ./configure --with-debug=yes
</pre></div>

<p>In addition to providing the usual debugging information in the
debugger, this also activates several environment variables which
might be used to monitor the actions in gtk+ and its associated
libraries.
</p>
<p>These variables are the following:
</p>
<div class="smallexample">
<pre class="smallexample">export GTK_DEBUG=misc:plugsocket:text:tree:updates:keybindings;
export GDK_DEBUG=updates:nograbs:events:dnd:misc:xim:colormap:gdkrb:gc:pixmap:image:input:cursor;
export GOBJECT_DEBUG=objects:signals;
</pre></div>

<p>Some of the values for these variables can be omitted. The exact
semantic (or even the exact list) of such variables depends on your
version of gtk+, and you should therefore consult its documentation.
</p>

<a name="debugger"></a>
<h3 class="section">8.3 debugger</h3>

<p>When debugging with <code>gdb</code>, it is recommended that you always
specify the flag <code>--sync</code> to gps. This forces any gtk+
application, and in particular GPS, to process X11 events
synchronously, and therefore makes it easier to debug possible
problems.
</p>
<p>If your application is printing some gtk+ warnings on the console, you
should do the following in the debugger:
</p>
<div class="smallexample">
<pre class="smallexample">  (gdb) set args --sync
  (gdb) begin
  (gdb) break g_log
  (gdb) cont
</pre></div>

<p>This will stop the application as soon as the gtk+ warning is printed.
</p>
<hr>
<a name="Contexts"></a>
<a name="Contexts-1"></a>
<h2 class="chapter">9 Contexts</h2>



<hr>
<a name="GNU-General-Public-License"></a>
<a name="GNU-General-Public-License-1"></a>
<h2 class="appendix">Appendix A GNU General Public License</h2>
<a name="index-GNU-General-Public-License"></a>
<a name="index-License_002c-GNU-General-Public-License"></a>
<pre class="verbatim">		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The &quot;Program&quot;, below,
refers to any such program or work, and a &quot;work based on the Program&quot;
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term &quot;modification&quot;.)  Each licensee is addressed as &quot;you&quot;.

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and &quot;any
later version&quot;, you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	    How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the &quot;copyright&quot; line and a pointer to where the full notice is found.

    &lt;one line to give the program's name and a brief idea of what it does.&gt;
    Copyright (C) 19yy  &lt;name of author&gt;

    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 2 of the License, 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19yy name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a &quot;copyright disclaimer&quot; for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  &lt;signature of Ty Coon&gt;, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
</pre>
<a name="Index"></a>
<h2 class="unnumbered">Index</h2>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#GNU-General-Public-License_cp_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-K"><b>K</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-T"><b>T</b></a>
 &nbsp; 
</td></tr></table>
<table class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="GNU-General-Public-License_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-adding-menus">adding menus</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="GNU-General-Public-License_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-GNU-General-Public-License">GNU General Public License</a>:</td><td>&nbsp;</td><td valign="top"><a href="#GNU-General-Public-License">GNU General Public License</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="GNU-General-Public-License_cp_letter-K">K</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-key-bindings">key bindings</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="GNU-General-Public-License_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-License_002c-GNU-General-Public-License">License, GNU General Public License</a>:</td><td>&nbsp;</td><td valign="top"><a href="#GNU-General-Public-License">GNU General Public License</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="GNU-General-Public-License_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-menus">menus</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="GNU-General-Public-License_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-toolbar">toolbar</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#GNU-General-Public-License_cp_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-K"><b>K</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#GNU-General-Public-License_cp_letter-T"><b>T</b></a>
 &nbsp; 
</td></tr></table>


<hr>



</body>
</html>