OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [ada/] [prj.adb] - Blame information for rev 16

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                                  P R J                                   --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--          Copyright (C) 2001-2005, Free Software Foundation, Inc.         --
10
--                                                                          --
11
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17
-- for  more details.  You should have  received  a copy of the GNU General --
18
-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20
-- Boston, MA 02110-1301, USA.                                              --
21
--                                                                          --
22
-- GNAT was originally developed  by the GNAT team at  New York University. --
23
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
24
--                                                                          --
25
------------------------------------------------------------------------------
26
 
27
with Ada.Characters.Handling; use Ada.Characters.Handling;
28
 
29
with Namet;    use Namet;
30
with Output;   use Output;
31
with Osint;    use Osint;
32
with Prj.Attr;
33
with Prj.Env;
34
with Prj.Err;  use Prj.Err;
35
with Snames;   use Snames;
36
with Uintp;    use Uintp;
37
 
38
with GNAT.Case_Util; use GNAT.Case_Util;
39
 
40
package body Prj is
41
 
42
   Initial_Buffer_Size : constant := 100;
43
   --  Initial size for extensible buffer used in Add_To_Buffer
44
 
45
   The_Empty_String : Name_Id;
46
 
47
   Name_C_Plus_Plus : Name_Id;
48
 
49
   Default_Ada_Spec_Suffix_Id : Name_Id;
50
   Default_Ada_Body_Suffix_Id : Name_Id;
51
   Slash_Id                   : Name_Id;
52
   --  Initialized in Prj.Initialized, then never modified
53
 
54
   subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case;
55
 
56
   The_Casing_Images : constant array (Known_Casing) of String_Access :=
57
     (All_Lower_Case => new String'("lowercase"),
58
      All_Upper_Case => new String'("UPPERCASE"),
59
      Mixed_Case     => new String'("MixedCase"));
60
 
61
   Initialized : Boolean := False;
62
 
63
   Standard_Dot_Replacement      : constant Name_Id :=
64
     First_Name_Id + Character'Pos ('-');
65
 
66
   Std_Naming_Data : Naming_Data :=
67
     (Dot_Replacement           => Standard_Dot_Replacement,
68
      Dot_Repl_Loc              => No_Location,
69
      Casing                    => All_Lower_Case,
70
      Spec_Suffix               => No_Array_Element,
71
      Ada_Spec_Suffix           => No_Name,
72
      Spec_Suffix_Loc           => No_Location,
73
      Impl_Suffixes             => No_Impl_Suffixes,
74
      Supp_Suffixes             => No_Supp_Language_Index,
75
      Body_Suffix               => No_Array_Element,
76
      Ada_Body_Suffix           => No_Name,
77
      Body_Suffix_Loc           => No_Location,
78
      Separate_Suffix           => No_Name,
79
      Sep_Suffix_Loc            => No_Location,
80
      Specs                     => No_Array_Element,
81
      Bodies                    => No_Array_Element,
82
      Specification_Exceptions  => No_Array_Element,
83
      Implementation_Exceptions => No_Array_Element);
84
 
85
   Project_Empty : Project_Data :=
86
     (Externally_Built               => False,
87
      Languages                      => No_Languages,
88
      Supp_Languages                 => No_Supp_Language_Index,
89
      First_Referred_By              => No_Project,
90
      Name                           => No_Name,
91
      Display_Name                   => No_Name,
92
      Path_Name                      => No_Name,
93
      Display_Path_Name              => No_Name,
94
      Virtual                        => False,
95
      Location                       => No_Location,
96
      Mains                          => Nil_String,
97
      Directory                      => No_Name,
98
      Display_Directory              => No_Name,
99
      Dir_Path                       => null,
100
      Library                        => False,
101
      Library_Dir                    => No_Name,
102
      Display_Library_Dir            => No_Name,
103
      Library_Src_Dir                => No_Name,
104
      Display_Library_Src_Dir        => No_Name,
105
      Library_ALI_Dir                => No_Name,
106
      Display_Library_ALI_Dir        => No_Name,
107
      Library_Name                   => No_Name,
108
      Library_Kind                   => Static,
109
      Lib_Internal_Name              => No_Name,
110
      Standalone_Library             => False,
111
      Lib_Interface_ALIs             => Nil_String,
112
      Lib_Auto_Init                  => False,
113
      Symbol_Data                    => No_Symbols,
114
      Ada_Sources_Present            => True,
115
      Other_Sources_Present          => True,
116
      Sources                        => Nil_String,
117
      First_Other_Source             => No_Other_Source,
118
      Last_Other_Source              => No_Other_Source,
119
      Imported_Directories_Switches  => null,
120
      Include_Path                   => null,
121
      Include_Data_Set               => False,
122
      Source_Dirs                    => Nil_String,
123
      Known_Order_Of_Source_Dirs     => True,
124
      Object_Directory               => No_Name,
125
      Display_Object_Dir             => No_Name,
126
      Library_TS                     => Empty_Time_Stamp,
127
      Exec_Directory                 => No_Name,
128
      Display_Exec_Dir               => No_Name,
129
      Extends                        => No_Project,
130
      Extended_By                    => No_Project,
131
      Naming                         => Std_Naming_Data,
132
      First_Language_Processing      => Default_First_Language_Processing_Data,
133
      Supp_Language_Processing       => No_Supp_Language_Index,
134
      Default_Linker                 => No_Name,
135
      Default_Linker_Path            => No_Name,
136
      Decl                           => No_Declarations,
137
      Imported_Projects              => Empty_Project_List,
138
      All_Imported_Projects          => Empty_Project_List,
139
      Ada_Include_Path               => null,
140
      Ada_Objects_Path               => null,
141
      Include_Path_File              => No_Name,
142
      Objects_Path_File_With_Libs    => No_Name,
143
      Objects_Path_File_Without_Libs => No_Name,
144
      Config_File_Name               => No_Name,
145
      Config_File_Temp               => False,
146
      Config_Checked                 => False,
147
      Language_Independent_Checked   => False,
148
      Checked                        => False,
149
      Seen                           => False,
150
      Need_To_Build_Lib              => False,
151
      Depth                          => 0,
152
      Unkept_Comments                => False);
153
 
154
   -----------------------
155
   -- Add_Language_Name --
156
   -----------------------
157
 
158
   procedure Add_Language_Name (Name : Name_Id) is
159
   begin
160
      Last_Language_Index := Last_Language_Index + 1;
161
      Language_Indexes.Set (Name, Last_Language_Index);
162
      Language_Names.Increment_Last;
163
      Language_Names.Table (Last_Language_Index) := Name;
164
   end Add_Language_Name;
165
 
166
   -------------------
167
   -- Add_To_Buffer --
168
   -------------------
169
 
170
   procedure Add_To_Buffer
171
     (S    : String;
172
      To   : in out String_Access;
173
      Last : in out Natural)
174
   is
175
   begin
176
      if To = null then
177
         To := new String (1 .. Initial_Buffer_Size);
178
         Last := 0;
179
      end if;
180
 
181
      --  If Buffer is too small, double its size
182
 
183
      while Last + S'Length > To'Last loop
184
         declare
185
            New_Buffer : constant  String_Access :=
186
                           new String (1 .. 2 * Last);
187
 
188
         begin
189
            New_Buffer (1 .. Last) := To (1 .. Last);
190
            Free (To);
191
            To := New_Buffer;
192
         end;
193
      end loop;
194
 
195
      To (Last + 1 .. Last + S'Length) := S;
196
      Last := Last + S'Length;
197
   end Add_To_Buffer;
198
 
199
   -----------------------------
200
   -- Default_Ada_Body_Suffix --
201
   -----------------------------
202
 
203
   function Default_Ada_Body_Suffix return Name_Id is
204
   begin
205
      return Default_Ada_Body_Suffix_Id;
206
   end Default_Ada_Body_Suffix;
207
 
208
   -----------------------------
209
   -- Default_Ada_Spec_Suffix --
210
   -----------------------------
211
 
212
   function Default_Ada_Spec_Suffix return Name_Id is
213
   begin
214
      return Default_Ada_Spec_Suffix_Id;
215
   end Default_Ada_Spec_Suffix;
216
 
217
   ---------------------------
218
   -- Display_Language_Name --
219
   ---------------------------
220
 
221
   procedure Display_Language_Name (Language : Language_Index) is
222
   begin
223
      Get_Name_String (Language_Names.Table (Language));
224
      To_Upper (Name_Buffer (1 .. 1));
225
      Write_Str (Name_Buffer (1 .. Name_Len));
226
   end Display_Language_Name;
227
 
228
   -------------------
229
   -- Empty_Project --
230
   -------------------
231
 
232
   function Empty_Project (Tree : Project_Tree_Ref)  return Project_Data is
233
      Value : Project_Data;
234
   begin
235
      Prj.Initialize (Tree => No_Project_Tree);
236
      Value := Project_Empty;
237
      Value.Naming := Tree.Private_Part.Default_Naming;
238
      return Value;
239
   end Empty_Project;
240
 
241
   ------------------
242
   -- Empty_String --
243
   ------------------
244
 
245
   function Empty_String return Name_Id is
246
   begin
247
      return The_Empty_String;
248
   end Empty_String;
249
 
250
   ------------
251
   -- Expect --
252
   ------------
253
 
254
   procedure Expect (The_Token : Token_Type; Token_Image : String) is
255
   begin
256
      if Token /= The_Token then
257
         Error_Msg (Token_Image & " expected", Token_Ptr);
258
      end if;
259
   end Expect;
260
 
261
   --------------------------------
262
   -- For_Every_Project_Imported --
263
   --------------------------------
264
 
265
   procedure For_Every_Project_Imported
266
     (By         : Project_Id;
267
      In_Tree    : Project_Tree_Ref;
268
      With_State : in out State)
269
   is
270
 
271
      procedure Recursive_Check (Project : Project_Id);
272
      --  Check if a project has already been seen. If not seen, mark it as
273
      --  Seen, Call Action, and check all its imported projects.
274
 
275
      ---------------------
276
      -- Recursive_Check --
277
      ---------------------
278
 
279
      procedure Recursive_Check (Project : Project_Id) is
280
         List : Project_List;
281
 
282
      begin
283
         if not In_Tree.Projects.Table (Project).Seen then
284
            In_Tree.Projects.Table (Project).Seen := True;
285
            Action (Project, With_State);
286
 
287
            List :=
288
              In_Tree.Projects.Table (Project).Imported_Projects;
289
            while List /= Empty_Project_List loop
290
               Recursive_Check (In_Tree.Project_Lists.Table (List).Project);
291
               List := In_Tree.Project_Lists.Table (List).Next;
292
            end loop;
293
         end if;
294
      end Recursive_Check;
295
 
296
   --  Start of processing for For_Every_Project_Imported
297
 
298
   begin
299
      for Project in Project_Table.First ..
300
                     Project_Table.Last (In_Tree.Projects)
301
      loop
302
         In_Tree.Projects.Table (Project).Seen := False;
303
      end loop;
304
 
305
      Recursive_Check (Project => By);
306
   end For_Every_Project_Imported;
307
 
308
   ----------
309
   -- Hash --
310
   ----------
311
 
312
   function Hash (Name : Name_Id) return Header_Num is
313
   begin
314
      return Hash (Get_Name_String (Name));
315
   end Hash;
316
 
317
   -----------
318
   -- Image --
319
   -----------
320
 
321
   function Image (Casing : Casing_Type) return String is
322
   begin
323
      return The_Casing_Images (Casing).all;
324
   end Image;
325
 
326
   ----------------
327
   -- Initialize --
328
   ----------------
329
 
330
   procedure Initialize (Tree : Project_Tree_Ref) is
331
   begin
332
      if not Initialized then
333
         Initialized := True;
334
         Uintp.Initialize;
335
         Name_Len := 0;
336
         The_Empty_String := Name_Find;
337
         Empty_Name := The_Empty_String;
338
         Name_Len := 4;
339
         Name_Buffer (1 .. 4) := ".ads";
340
         Default_Ada_Spec_Suffix_Id := Name_Find;
341
         Name_Len := 4;
342
         Name_Buffer (1 .. 4) := ".adb";
343
         Default_Ada_Body_Suffix_Id := Name_Find;
344
         Name_Len := 1;
345
         Name_Buffer (1) := '/';
346
         Slash_Id := Name_Find;
347
         Name_Len := 3;
348
         Name_Buffer (1 .. 3) := "c++";
349
         Name_C_Plus_Plus := Name_Find;
350
 
351
         Std_Naming_Data.Ada_Spec_Suffix := Default_Ada_Spec_Suffix;
352
         Std_Naming_Data.Ada_Body_Suffix := Default_Ada_Body_Suffix;
353
         Std_Naming_Data.Separate_Suffix := Default_Ada_Body_Suffix;
354
         Project_Empty.Naming := Std_Naming_Data;
355
         Prj.Env.Initialize;
356
         Prj.Attr.Initialize;
357
         Set_Name_Table_Byte (Name_Project,  Token_Type'Pos (Tok_Project));
358
         Set_Name_Table_Byte (Name_Extends,  Token_Type'Pos (Tok_Extends));
359
         Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External));
360
 
361
         Language_Indexes.Reset;
362
         Last_Language_Index := No_Language_Index;
363
         Language_Names.Init;
364
         Add_Language_Name (Name_Ada);
365
         Add_Language_Name (Name_C);
366
         Add_Language_Name (Name_C_Plus_Plus);
367
      end if;
368
 
369
      if Tree /= No_Project_Tree then
370
         Reset (Tree);
371
      end if;
372
   end Initialize;
373
 
374
   ----------------
375
   -- Is_Present --
376
   ----------------
377
 
378
   function Is_Present
379
     (Language   : Language_Index;
380
      In_Project : Project_Data;
381
      In_Tree    : Project_Tree_Ref) return Boolean
382
   is
383
   begin
384
      case Language is
385
         when No_Language_Index =>
386
            return False;
387
 
388
         when First_Language_Indexes =>
389
            return In_Project.Languages (Language);
390
 
391
         when others =>
392
            declare
393
               Supp : Supp_Language;
394
               Supp_Index : Supp_Language_Index := In_Project.Supp_Languages;
395
 
396
            begin
397
               while Supp_Index /= No_Supp_Language_Index loop
398
                  Supp := In_Tree.Present_Languages.Table (Supp_Index);
399
 
400
                  if Supp.Index = Language then
401
                     return Supp.Present;
402
                  end if;
403
 
404
                  Supp_Index := Supp.Next;
405
               end loop;
406
 
407
               return False;
408
            end;
409
      end case;
410
   end Is_Present;
411
 
412
   ---------------------------------
413
   -- Language_Processing_Data_Of --
414
   ---------------------------------
415
 
416
   function Language_Processing_Data_Of
417
     (Language   : Language_Index;
418
      In_Project : Project_Data;
419
      In_Tree    : Project_Tree_Ref) return Language_Processing_Data
420
   is
421
   begin
422
      case Language is
423
         when No_Language_Index =>
424
            return Default_Language_Processing_Data;
425
 
426
         when First_Language_Indexes =>
427
            return In_Project.First_Language_Processing (Language);
428
 
429
         when others =>
430
            declare
431
               Supp : Supp_Language_Data;
432
               Supp_Index : Supp_Language_Index :=
433
                 In_Project.Supp_Language_Processing;
434
 
435
            begin
436
               while Supp_Index /= No_Supp_Language_Index loop
437
                  Supp := In_Tree.Supp_Languages.Table (Supp_Index);
438
 
439
                  if Supp.Index = Language then
440
                     return Supp.Data;
441
                  end if;
442
 
443
                  Supp_Index := Supp.Next;
444
               end loop;
445
 
446
               return Default_Language_Processing_Data;
447
            end;
448
      end case;
449
   end Language_Processing_Data_Of;
450
 
451
   ------------------------------------
452
   -- Register_Default_Naming_Scheme --
453
   ------------------------------------
454
 
455
   procedure Register_Default_Naming_Scheme
456
     (Language            : Name_Id;
457
      Default_Spec_Suffix : Name_Id;
458
      Default_Body_Suffix : Name_Id;
459
      In_Tree             : Project_Tree_Ref)
460
   is
461
      Lang : Name_Id;
462
      Suffix : Array_Element_Id;
463
      Found : Boolean := False;
464
      Element : Array_Element;
465
 
466
   begin
467
      --  Get the language name in small letters
468
 
469
      Get_Name_String (Language);
470
      Name_Buffer (1 .. Name_Len) := To_Lower (Name_Buffer (1 .. Name_Len));
471
      Lang := Name_Find;
472
 
473
      Suffix := In_Tree.Private_Part.Default_Naming.Spec_Suffix;
474
      Found := False;
475
 
476
      --  Look for an element of the spec sufix array indexed by the language
477
      --  name. If one is found, put the default value.
478
 
479
      while Suffix /= No_Array_Element and then not Found loop
480
         Element := In_Tree.Array_Elements.Table (Suffix);
481
 
482
         if Element.Index = Lang then
483
            Found := True;
484
            Element.Value.Value := Default_Spec_Suffix;
485
            In_Tree.Array_Elements.Table (Suffix) := Element;
486
 
487
         else
488
            Suffix := Element.Next;
489
         end if;
490
      end loop;
491
 
492
      --  If none can be found, create a new one
493
 
494
      if not Found then
495
         Element :=
496
           (Index     => Lang,
497
            Src_Index => 0,
498
            Index_Case_Sensitive => False,
499
            Value => (Project  => No_Project,
500
                      Kind     => Single,
501
                      Location => No_Location,
502
                      Default  => False,
503
                      Value    => Default_Spec_Suffix,
504
                      Index    => 0),
505
            Next  => In_Tree.Private_Part.Default_Naming.Spec_Suffix);
506
         Array_Element_Table.Increment_Last (In_Tree.Array_Elements);
507
         In_Tree.Array_Elements.Table
508
           (Array_Element_Table.Last (In_Tree.Array_Elements)) :=
509
            Element;
510
         In_Tree.Private_Part.Default_Naming.Spec_Suffix :=
511
           Array_Element_Table.Last (In_Tree.Array_Elements);
512
      end if;
513
 
514
      Suffix := In_Tree.Private_Part.Default_Naming.Body_Suffix;
515
      Found := False;
516
 
517
      --  Look for an element of the body sufix array indexed by the language
518
      --  name. If one is found, put the default value.
519
 
520
      while Suffix /= No_Array_Element and then not Found loop
521
         Element := In_Tree.Array_Elements.Table (Suffix);
522
 
523
         if Element.Index = Lang then
524
            Found := True;
525
            Element.Value.Value := Default_Body_Suffix;
526
            In_Tree.Array_Elements.Table (Suffix) := Element;
527
 
528
         else
529
            Suffix := Element.Next;
530
         end if;
531
      end loop;
532
 
533
      --  If none can be found, create a new one
534
 
535
      if not Found then
536
         Element :=
537
           (Index     => Lang,
538
            Src_Index => 0,
539
            Index_Case_Sensitive => False,
540
            Value => (Project  => No_Project,
541
                      Kind     => Single,
542
                      Location => No_Location,
543
                      Default  => False,
544
                      Value    => Default_Body_Suffix,
545
                      Index    => 0),
546
            Next  => In_Tree.Private_Part.Default_Naming.Body_Suffix);
547
         Array_Element_Table.Increment_Last
548
           (In_Tree.Array_Elements);
549
         In_Tree.Array_Elements.Table
550
           (Array_Element_Table.Last (In_Tree.Array_Elements))
551
             := Element;
552
         In_Tree.Private_Part.Default_Naming.Body_Suffix :=
553
           Array_Element_Table.Last (In_Tree.Array_Elements);
554
      end if;
555
   end Register_Default_Naming_Scheme;
556
 
557
   -----------
558
   -- Reset --
559
   -----------
560
 
561
   procedure Reset (Tree : Project_Tree_Ref) is
562
   begin
563
      Prj.Env.Initialize;
564
      Present_Language_Table.Init (Tree.Present_Languages);
565
      Supp_Suffix_Table.Init      (Tree.Supp_Suffixes);
566
      Name_List_Table.Init        (Tree.Name_Lists);
567
      Supp_Language_Table.Init    (Tree.Supp_Languages);
568
      Other_Source_Table.Init     (Tree.Other_Sources);
569
      String_Element_Table.Init   (Tree.String_Elements);
570
      Variable_Element_Table.Init (Tree.Variable_Elements);
571
      Array_Element_Table.Init    (Tree.Array_Elements);
572
      Array_Table.Init            (Tree.Arrays);
573
      Package_Table.Init          (Tree.Packages);
574
      Project_List_Table.Init     (Tree.Project_Lists);
575
      Project_Table.Init          (Tree.Projects);
576
      Unit_Table.Init             (Tree.Units);
577
      Units_Htable.Reset          (Tree.Units_HT);
578
      Files_Htable.Reset          (Tree.Files_HT);
579
      Naming_Table.Init           (Tree.Private_Part.Namings);
580
      Path_File_Table.Init        (Tree.Private_Part.Path_Files);
581
      Source_Path_Table.Init      (Tree.Private_Part.Source_Paths);
582
      Object_Path_Table.Init      (Tree.Private_Part.Object_Paths);
583
      Tree.Private_Part.Default_Naming := Std_Naming_Data;
584
      Register_Default_Naming_Scheme
585
        (Language            => Name_Ada,
586
         Default_Spec_Suffix => Default_Ada_Spec_Suffix,
587
         Default_Body_Suffix => Default_Ada_Body_Suffix,
588
         In_Tree             => Tree);
589
   end Reset;
590
 
591
   ------------------------
592
   -- Same_Naming_Scheme --
593
   ------------------------
594
 
595
   function Same_Naming_Scheme
596
     (Left, Right : Naming_Data) return Boolean
597
   is
598
   begin
599
      return Left.Dot_Replacement = Right.Dot_Replacement
600
        and then Left.Casing = Right.Casing
601
        and then Left.Ada_Spec_Suffix = Right.Ada_Spec_Suffix
602
        and then Left.Ada_Body_Suffix = Right.Ada_Body_Suffix
603
        and then Left.Separate_Suffix = Right.Separate_Suffix;
604
   end Same_Naming_Scheme;
605
 
606
   ---------
607
   -- Set --
608
   ---------
609
 
610
   procedure Set
611
     (Language   : Language_Index;
612
      Present    : Boolean;
613
      In_Project : in out Project_Data;
614
      In_Tree    : Project_Tree_Ref)
615
   is
616
   begin
617
      case Language is
618
         when No_Language_Index =>
619
            null;
620
 
621
         when First_Language_Indexes =>
622
            In_Project.Languages (Language) := Present;
623
 
624
         when others =>
625
            declare
626
               Supp : Supp_Language;
627
               Supp_Index : Supp_Language_Index := In_Project.Supp_Languages;
628
 
629
            begin
630
               while Supp_Index /= No_Supp_Language_Index loop
631
                  Supp := In_Tree.Present_Languages.Table
632
                                                                (Supp_Index);
633
 
634
                  if Supp.Index = Language then
635
                     In_Tree.Present_Languages.Table
636
                                            (Supp_Index).Present := Present;
637
                     return;
638
                  end if;
639
 
640
                  Supp_Index := Supp.Next;
641
               end loop;
642
 
643
               Supp := (Index => Language, Present => Present,
644
                        Next  => In_Project.Supp_Languages);
645
               Present_Language_Table.Increment_Last
646
                 (In_Tree.Present_Languages);
647
               Supp_Index := Present_Language_Table.Last
648
                 (In_Tree.Present_Languages);
649
               In_Tree.Present_Languages.Table (Supp_Index) :=
650
                 Supp;
651
               In_Project.Supp_Languages := Supp_Index;
652
            end;
653
      end case;
654
   end Set;
655
 
656
   procedure Set
657
     (Language_Processing : Language_Processing_Data;
658
      For_Language        : Language_Index;
659
      In_Project          : in out Project_Data;
660
      In_Tree             : Project_Tree_Ref)
661
   is
662
   begin
663
      case For_Language is
664
         when No_Language_Index =>
665
            null;
666
 
667
         when First_Language_Indexes =>
668
            In_Project.First_Language_Processing (For_Language) :=
669
              Language_Processing;
670
 
671
         when others =>
672
            declare
673
               Supp : Supp_Language_Data;
674
               Supp_Index : Supp_Language_Index :=
675
                 In_Project.Supp_Language_Processing;
676
 
677
            begin
678
               while Supp_Index /= No_Supp_Language_Index loop
679
                  Supp := In_Tree.Supp_Languages.Table (Supp_Index);
680
 
681
                  if Supp.Index = For_Language then
682
                     In_Tree.Supp_Languages.Table
683
                       (Supp_Index).Data := Language_Processing;
684
                     return;
685
                  end if;
686
 
687
                  Supp_Index := Supp.Next;
688
               end loop;
689
 
690
               Supp := (Index => For_Language, Data => Language_Processing,
691
                        Next  => In_Project.Supp_Language_Processing);
692
               Supp_Language_Table.Increment_Last
693
                 (In_Tree.Supp_Languages);
694
               Supp_Index := Supp_Language_Table.Last
695
                               (In_Tree.Supp_Languages);
696
               In_Tree.Supp_Languages.Table (Supp_Index) := Supp;
697
               In_Project.Supp_Language_Processing := Supp_Index;
698
            end;
699
      end case;
700
   end Set;
701
 
702
   procedure Set
703
     (Suffix       : Name_Id;
704
      For_Language : Language_Index;
705
      In_Project   : in out Project_Data;
706
      In_Tree      : Project_Tree_Ref)
707
   is
708
   begin
709
      case For_Language is
710
         when No_Language_Index =>
711
            null;
712
 
713
         when First_Language_Indexes =>
714
            In_Project.Naming.Impl_Suffixes (For_Language) := Suffix;
715
 
716
         when others =>
717
            declare
718
               Supp : Supp_Suffix;
719
               Supp_Index : Supp_Language_Index :=
720
                 In_Project.Naming.Supp_Suffixes;
721
 
722
            begin
723
               while Supp_Index /= No_Supp_Language_Index loop
724
                  Supp := In_Tree.Supp_Suffixes.Table
725
                                                            (Supp_Index);
726
 
727
                  if Supp.Index = For_Language then
728
                     In_Tree.Supp_Suffixes.Table
729
                       (Supp_Index).Suffix := Suffix;
730
                     return;
731
                  end if;
732
 
733
                  Supp_Index := Supp.Next;
734
               end loop;
735
 
736
               Supp := (Index => For_Language, Suffix => Suffix,
737
                        Next  => In_Project.Naming.Supp_Suffixes);
738
               Supp_Suffix_Table.Increment_Last
739
                 (In_Tree.Supp_Suffixes);
740
               Supp_Index := Supp_Suffix_Table.Last
741
                 (In_Tree.Supp_Suffixes);
742
               In_Tree.Supp_Suffixes.Table (Supp_Index) := Supp;
743
               In_Project.Naming.Supp_Suffixes := Supp_Index;
744
            end;
745
      end case;
746
   end Set;
747
 
748
   -----------
749
   -- Slash --
750
   -----------
751
 
752
   function Slash return Name_Id is
753
   begin
754
      return Slash_Id;
755
   end Slash;
756
 
757
   --------------------------
758
   -- Standard_Naming_Data --
759
   --------------------------
760
 
761
   function Standard_Naming_Data
762
     (Tree : Project_Tree_Ref := No_Project_Tree) return Naming_Data
763
   is
764
   begin
765
      if Tree = No_Project_Tree then
766
         Prj.Initialize (Tree => No_Project_Tree);
767
         return Std_Naming_Data;
768
 
769
      else
770
         return Tree.Private_Part.Default_Naming;
771
      end if;
772
   end Standard_Naming_Data;
773
 
774
   ---------------
775
   -- Suffix_Of --
776
   ---------------
777
 
778
   function Suffix_Of
779
     (Language   : Language_Index;
780
      In_Project : Project_Data;
781
      In_Tree    : Project_Tree_Ref) return Name_Id
782
   is
783
   begin
784
      case Language is
785
         when No_Language_Index =>
786
            return No_Name;
787
 
788
         when First_Language_Indexes =>
789
            return In_Project.Naming.Impl_Suffixes (Language);
790
 
791
         when others =>
792
            declare
793
               Supp : Supp_Suffix;
794
               Supp_Index : Supp_Language_Index :=
795
                 In_Project.Naming.Supp_Suffixes;
796
 
797
            begin
798
               while Supp_Index /= No_Supp_Language_Index loop
799
                  Supp := In_Tree.Supp_Suffixes.Table (Supp_Index);
800
 
801
                  if Supp.Index = Language then
802
                     return Supp.Suffix;
803
                  end if;
804
 
805
                  Supp_Index := Supp.Next;
806
               end loop;
807
 
808
               return No_Name;
809
            end;
810
      end case;
811
   end  Suffix_Of;
812
 
813
   -----------
814
   -- Value --
815
   -----------
816
 
817
   function Value (Image : String) return Casing_Type is
818
   begin
819
      for Casing in The_Casing_Images'Range loop
820
         if To_Lower (Image) = To_Lower (The_Casing_Images (Casing).all) then
821
            return Casing;
822
         end if;
823
      end loop;
824
 
825
      raise Constraint_Error;
826
   end Value;
827
 
828
begin
829
   --  Make sure that the standard project file extension is compatible
830
   --  with canonical case file naming.
831
 
832
   Canonical_Case_File_Name (Project_File_Extension);
833
end Prj;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.