This file is indexed.

/usr/share/ada/adainclude/texttools/common.adb is in libtexttools5-dev 2.1.0-8.

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
------------------------------------------------------------------------------
-- COMMON (package body)                                                    --
--                                                                          --
-- Part of TextTools                                                        --
-- Designed and Programmed by Ken O. Burtch                                 --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
--                 Copyright (C) 1999-2007 Ken O. Burtch                    --
--                                                                          --
-- This is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion.  This is distributed in the hope that it will be useful, but WITH- --
-- OUT 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  distributed with this;  see file COPYING.  If not, write --
-- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
-- MA 02111-1307, USA.                                                      --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
-- This is maintained at http://www.pegasoft.ca/tt.html                     --
--                                                                          --
------------------------------------------------------------------------------
package body Common is
   
---> Housekeeping

procedure StartupCommon ( theProgramName, theShortProgramName : string ) is
-- start up this package
begin
  LastError := 0;
  RaisingErrors := false;
  ProgramName := Ada.Strings.Unbounded.To_Unbounded_String (TheProgramName );
  ShortProgramName := Ada.Strings.Unbounded.To_Unbounded_String ( theShortProgramName );
end StartupCommon;

procedure IdleCommon( IdlePeriod : in Duration ) is
-- idle-time tasks
   pragma Unreferenced (Idleperiod);
begin
  NoError;
end IdleCommon;

procedure ShutdownCommon is
-- shutdown this package
begin
  NoError;
end ShutdownCommon;

---> Error Trapping

procedure NoError is
-- clear last error
begin
  LastError := 0;
  --Str255List.Clear( LastErrorDetails );
end NoError;

procedure Error( ErrorCode : AnErrorCode ) is
-- record an error, raising an exception if necessary
begin
  LastError := ErrorCode;
  if ErrorCode /= TT_OK and then RaisingErrors then
     raise GeneralError;
  end if;
end Error;

procedure RaiseErrors is
-- raise a general error on upcoming errors
begin
  RaisingErrors := true;
end RaiseErrors;

procedure TrapErrors is
-- trap upcoming errors and put value in LastError
begin
  RaisingErrors := false;
end TrapErrors;

function RaiseErrors return boolean is
  WasRaising : boolean;
begin
  WasRaising := RaisingErrors;
  RaisingErrors := true;
  return WasRaising;
end RaiseErrors;

function TrapErrors return boolean is
  WasRaising : boolean;
begin
  WasRaising := RaisingErrors;
  RaisingErrors := false;
  return WasRaising;
end TrapErrors;

procedure RestoreRaising( oldflag : boolean ) is
begin
  RaisingErrors := oldflag;
end RestoreRaising;

---> Rectangles

procedure SetRect( r : out ARect; left, top, right, bottom : integer ) is
-- initialize a rectangle
begin
  r.left := left;
  r.top  := top;
  r.right := right;
  r.bottom := bottom;
end SetRect;

procedure OffsetRect( r : in out ARect; dx, dy : integer ) is
-- shift a rectangle
begin
  r.left := r.left + dx;
  r.top := r.top + dy;
  r.right := r.right + dx;
  r.bottom := r.bottom + dy;
end OffsetRect;

function OffsetRect( r : in ARect; dx, dy : integer ) return ARect is
-- shift a rectangle returning the resulting rectangle
  newRect : ARect;
begin
  newRect.left := r.left + dx;
  newRect.top := r.top + dy;
  newRect.right := r.right + dx;
  newRect.bottom := r.bottom + dy;
  return newRect;
end OffsetRect;

procedure InsetRect( r : in out ARect; dx, dy : integer ) is
-- change the size of a rectangle
begin
  r.left := r.left + dx;
  r.top := r.top + dy;
  r.right := r.right - dx;
  r.bottom := r.bottom - dy;
end InsetRect;

function InsetRect( r : in ARect; dx, dy : integer ) return ARect is
-- change the size of a rectangle returning the resulting rectangle
  newRect : ARect;
begin
  newRect.left := r.left + dx;
  newRect.top := r.top + dy;
  newRect.right := r.right - dx;
  newRect.bottom := r.bottom - dy;
  return newRect;
end InsetRect;

function InsideRect( Inner, Outer : in ARect ) return boolean is
-- test for one rectangle inside of another
begin
  return (Inner.left   >= Outer.left)   and then
         (Inner.top    >= Outer.top)    and then
         (Inner.right  <= Outer.right ) and then
         (Inner.bottom <= Outer.bottom );
end InsideRect;

function InRect( x, y : integer ; r : ARect ) return boolean is
-- test for a point inside of a rectangle
begin
  return (x >= r.left and x <= r.right) and then
         (y >= r.top and y <= r.bottom);
end InRect;

function IsEmptyRect( r : ARect ) return boolean is
begin
  return (r.left > r.right ) or (r.top > r.bottom );
end IsEmptyRect;

---> Sorting order for a list of rectangles

function RectOrder( left, right : ARect ) return boolean is
-- used to order rectangles in a rectangle list
begin
  return not InsideRect( left, right );
end RectOrder;

end Common;