Changeset 2630
- Timestamp:
- 02/22/08 10:51:37 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tendra/src/producers/ada/asis/asis-compilation_units-relations.adb
r2628 r2630 62 62 return Compilation_Unit_List_Access; 63 63 64 -- Tree_Node -- 64 -- Tree -- 65 type Root_Tree is 66 new Ada.Finalization.Limited_Controlled with private; 67 68 type Root_Tree_Access is access all Root_Tree; 69 65 70 type Tree_Node is 66 71 new Ada.Finalization.Limited_Controlled with private; … … 87 92 return Boolean; 88 93 89 -- Tree_Node -- 90 94 -- Root_Tree -- 91 95 type Orders is (Ascending, Descending); 92 96 93 97 procedure Dependence_Order 94 (This : in Tree_Node_Access;98 (This : in Root_Tree_Access; 95 99 Order : in Orders); 96 100 97 101 function Add_Child 98 (This : in Tree_Node_Access;102 (This : in Root_Tree_Access; 99 103 Node : in Tree_Node_Access; 100 104 Spec_Unit : in Compilation_Unit) … … 102 106 103 107 function Add_Child 104 (This : in Tree_Node_Access;108 (This : in Root_Tree_Access; 105 109 Node : in Tree_Node_Access; 106 110 Spec_Unit : in Compilation_Unit; … … 109 113 return Tree_Node_Access; 110 114 115 procedure Append 116 (This : in Root_Tree_Access; 117 Unit : in Compilation_Unit); 118 111 119 procedure Glue_Nodes 112 (This : in Tree_Node_Access;120 (This : in Root_Tree_Access; 113 121 Node : in Tree_Node_Access; 114 122 To_Node : in Tree_Node_Access); 115 123 116 124 procedure Glue_Nodes_Checked 117 (This : in Tree_Node_Access;125 (This : in Root_Tree_Access; 118 126 Node : in Tree_Node_Access; 119 127 To_Node : in Tree_Node_Access); 120 128 121 procedure Add_Body_Dependents122 (This : in Tree_Node_Access;123 To_Node : in Tree_Node_Access);124 125 function Is_Child126 (This : in Tree_Node_Access;127 Node : in Tree_Node_Access)128 return Boolean;129 130 129 procedure Set_Parent 131 (This : in Tree_Node_Access;130 (This : in Root_Tree_Access; 132 131 Node : in Tree_Node_Access; 133 132 Parent : in Tree_Node_Access); 134 133 135 134 procedure Clear 136 (This : in out Tree_Node); 135 (This : in out Root_Tree); 136 137 procedure Add_Body_Dependents 138 (This : in Root_Tree_Access; 139 Node : in Tree_Node_Access; 140 To_Node : in Tree_Node_Access); 137 141 138 142 function Find 139 (This : in Tree_Node;143 (This : in Root_Tree_Access; 140 144 Unit : in Compilation_Unit) 141 145 return Tree_Node_Access; 142 146 143 147 procedure Check 144 (This : in Tree_Node_Access;148 (This : in Root_Tree_Access; 145 149 The_Context : in Asis.Context); 146 150 147 151 function Generate_Relationship 148 (This : in Tree_Node_Access;152 (This : in Root_Tree_Access; 149 153 Limit_List : in Utils.Compilation_Unit_List_Access; 150 154 List_Last : in ASIS_Integer) 151 155 return Relationship; 152 156 157 function Create_Elaboration_Tree 158 (This : in Root_Tree_Access; 159 The_Context : in Asis.Context) 160 return Root_Tree_Access; 161 162 function Is_Child 163 (This : in Root_Tree_Access; 164 Node : in Tree_Node_Access) 165 return Boolean; 166 167 function Is_Have_Circular_Dependences 168 (This : in Root_Tree_Access) 169 return Boolean; 170 171 -- Tree_Node -- 153 172 function Is_Skip_Spec 154 173 (This : in Tree_Node_Access) … … 163 182 return Tree_Node_Array_Access; 164 183 165 function Spec184 function Get_Spec 166 185 (This : in Tree_Node_Access) 167 186 return Compilation_Unit; … … 174 193 175 194 private 195 196 -- Tree_Node -- 197 type Extended_Boolean is (Unknown, Extended_True, Extended_False); 198 199 type Tree_Node is 200 new Ada.Finalization.Limited_Controlled with record 201 Self : Tree_Node_Access := Tree_Node'Unchecked_Access; 202 203 -- ÑÑÑлка Ма пÑеЎÑÐŽÑÑОе елеЌеМÑÑ 204 Prevs : Tree_Node_Array_Access := null; 205 206 -- пПÑлеЎÑÑÑОе елеЌеМÑÑ 207 Next : Tree_Node_Array_Access := null; 208 209 -- ЌПЎÑлÑ_кПЌпОлÑÑОО 210 Unit : Compilation_Unit := Nil_Compilation_Unit; 211 Unit_Body : Compilation_Unit := Nil_Compilation_Unit; 212 Skip_Spec : Boolean := False; 213 214 Added : Boolean := False; 215 216 Consistent : Boolean := True; 217 Body_Consistent : Boolean := True; 218 219 -- завОÑОЌПÑÑО Ñела (with) 220 Body_Dependences : Tree_Node_Array_Access := null; 221 222 -- ÑпОÑПк ÑОклОÑеÑÐºÐžÑ 223 завОÑОЌПÑÑей 224 Circular : Compilation_Unit_List_Access := null; 225 Circular_Added : Boolean := False; 226 227 -- ÑпОÑПк пÑПпавÑÐžÑ 228 ÑМОÑПв 229 Missing : Compilation_Unit_List_Access := null; 230 Missing_Added : Boolean := False; 231 232 -- ÑпОÑПк МеÑПглаÑÑПваММÑÑ 233 ÑМОÑПв 234 Inconsistent : Compilation_Unit_List_Access := null; 235 Inconsistent_Added : Boolean := False; 236 237 Elaborated : Boolean := False; 238 Body_Elaborated : Boolean := False; 239 240 Internal_Pure : Extended_Boolean := Unknown; 241 end record; 242 243 procedure Finalize 244 (This : in out Tree_Node); 245 246 function Is_Pure 247 (This : in Tree_Node_Access) 248 return Boolean; 249 250 -- Root_Tree -- 176 251 177 252 type Unit_Node is record … … 183 258 type Unit_Node_Array_Access is access all Unit_Node_Array; 184 259 185 type Tree_Node is260 type Root_Tree is 186 261 new Ada.Finalization.Limited_Controlled with record 187 Self : Tree_Node_Access := Tree_Node'Unchecked_Access;262 Self : Root_Tree_Access := Root_Tree'Unchecked_Access; 188 263 189 264 Order : Orders := Descending; 190 191 -- ÑÑÑлка Ма пÑеЎÑÐŽÑÑОй ÐµÐ»ÐµÐŒÐµÐœÑ 192 Prev : Tree_Node_Access := null; 193 Prevs : Tree_Node_Array_Access := null; 194 195 -- ЌПЎÑлÑ_кПЌпОлÑÑОО 196 Unit : Compilation_Unit := Nil_Compilation_Unit; 197 Unit_Body : Compilation_Unit := Nil_Compilation_Unit; 198 Skip_Spec : Boolean := False; 199 200 Added : Boolean := False; 201 202 Consistent : Boolean := True; 203 Body_Consistent : Boolean := True; 204 205 -- пПÑлеЎÑÑÑОе елеЌеМÑÑ 206 Next : Tree_Node_Array_Access := null; 207 208 -- завОÑОЌПÑÑО Ñела (with) 209 Body_Dependences : Tree_Node_Array_Access := null; 265 Next : Tree_Node_Array_Access := null; 210 266 211 267 -- ÑПÑÑОÑПваММÑй ÑпОÑПк вÑÐµÑ … … 214 270 -- ПпÑÐµÐŽÐµÐ»ÐµÐœÐžÑ ÐœÐ°Ð»ÐžÑÐžÑ ÐµÐ»ÐµÐŒÐµÐœÑа 215 271 -- в ÑпОÑке 216 -- запПлМÑÐµÑ ÑПлÑкП кПÑМевПй елеЌеМÑ217 272 Units : Unit_Node_Array_Access := null; 218 273 219 -- ÑпОÑПк ÑОклОÑеÑÐºÐžÑ 220 завОÑОЌПÑÑей 221 Circular : Compilation_Unit_List_Access := null; 222 Circular_Added : Boolean := False; 223 224 -- ÑпОÑПк пÑПпавÑÐžÑ 225 ÑМОÑПв 226 Missing : Compilation_Unit_List_Access := null; 227 Missing_Added : Boolean := False; 228 229 -- ÑпОÑПк МеÑПглаÑÑПваММÑÑ 230 ÑМОÑПв 231 Inconsistent : Compilation_Unit_List_Access := null; 232 Inconsistent_Added : Boolean := False; 274 Last_Node : Tree_Node_Access := null; 233 275 end record; 234 276 235 277 procedure Finalize 236 (This : in out Tree_Node); 278 (This : in out Root_Tree); 279 280 -- Additional -- 281 procedure Deallocate is 282 new Ada.Unchecked_Deallocation 283 (Tree_Node, Tree_Node_Access); 237 284 238 285 procedure Deallocate is … … 286 333 procedure Deallocate is 287 334 new Ada.Unchecked_Deallocation 288 (Utils.Tree_Node, Utils.Tree_Node_Access); 335 (Utils.Root_Tree, Utils.Root_Tree_Access); 336 337 procedure Check_Compilation_Unit 338 (Unit : in Compilation_Unit; 339 The_Context : in Asis.Context; 340 Message : in Wide_String); 341 342 procedure Normalize 343 (List : in Asis.Compilation_Unit_List; 344 Result : in Utils.Compilation_Unit_List_Access; 345 Last : out ASIS_Integer); 289 346 290 347 function Get_Ancestors 291 348 (List : in Asis.Compilation_Unit_List; 292 349 The_Context : in Asis.Context) 293 return Utils. Tree_Node_Access;350 return Utils.Root_Tree_Access; 294 351 295 352 function Get_Descendants 296 353 (List : in Asis.Compilation_Unit_List; 297 354 The_Context : in Asis.Context) 298 return Utils. Tree_Node_Access;355 return Utils.Root_Tree_Access; 299 356 300 357 function Get_Supporters 301 358 (List : in Asis.Compilation_Unit_List; 302 359 The_Context : in Asis.Context) 303 return Utils. Tree_Node_Access;360 return Utils.Root_Tree_Access; 304 361 305 362 function Get_Dependents 306 363 (List : in Asis.Compilation_Unit_List; 307 364 The_Context : in Asis.Context) 308 return Utils. Tree_Node_Access;365 return Utils.Root_Tree_Access; 309 366 310 367 function Get_Family 311 368 (List : in Asis.Compilation_Unit_List; 312 369 The_Context : in Asis.Context) 313 return Utils. Tree_Node_Access;370 return Utils.Root_Tree_Access; 314 371 315 372 function Get_Needed_Units 316 373 (List : in Asis.Compilation_Unit_List; 317 374 The_Context : in Asis.Context) 318 return Utils. Tree_Node_Access;375 return Utils.Root_Tree_Access; 319 376 320 377 procedure Get_Subunits 321 (Tree : in Utils. Tree_Node_Access;378 (Tree : in Utils.Root_Tree_Access; 322 379 Unit : in Compilation_Unit; 323 380 Node : in Utils.Tree_Node_Access; … … 347 404 return Check_10_1_1_26c_26b_Information; 348 405 406 ---------------------------- 407 -- Check_Compilation_Unit -- 408 ---------------------------- 409 410 procedure Check_Compilation_Unit 411 (Unit : in Compilation_Unit; 412 The_Context : in Asis.Context; 413 Message : in Wide_String) 414 is 415 Kind : Asis.Unit_Kinds; 416 begin 417 Kind := Unit_Kind (Unit); 418 419 if Kind = Not_A_Unit 420 or else Kind = A_Nonexistent_Declaration 421 or else Kind = A_Nonexistent_Body 422 or else Kind = A_Configuration_Compilation 423 then 424 Asis.Implementation.Set_Status 425 (Data_Error, Message & " invalid unit " & Unit_Full_Name (Unit)); 426 427 raise Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit; 428 end if; 429 430 if not Asis.Ada_Environments.Is_Equal 431 (Enclosing_Context (Unit), The_Context) 432 then 433 Asis.Implementation.Set_Status 434 (Data_Error, Message & " invalid unit's context " 435 & Unit_Full_Name (Unit)); 436 437 raise Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit; 438 end if; 439 end Check_Compilation_Unit; 440 441 --------------- 442 -- Normalize -- 443 --------------- 444 445 procedure Normalize 446 (List : in Asis.Compilation_Unit_List; 447 Result : in Utils.Compilation_Unit_List_Access; 448 Last : out ASIS_Integer) 449 is 450 Unit : Compilation_Unit; 451 begin 452 Last := 0; 453 454 for Index in List'Range loop 455 Unit := List (Index); 456 457 if not Is_Nil (Unit) 458 and then Unit_Kind (Unit) /= An_Unknown_Unit 459 then 460 if not Utils.In_List (Result, Last, Unit) then 461 Last := Last + 1; 462 Result (Last) := List (Index); 463 end if; 464 end if; 465 end loop; 466 end Normalize; 467 349 468 ------------------------- 350 469 -- Elaboration_Order -- * … … 356 475 return Relationship 357 476 is 477 procedure Clear; 478 479 Tree : Utils.Root_Tree_Access := null; 480 Elaborate_Tree : Utils.Root_Tree_Access := null; 481 482 Compilation_Units_Last : ASIS_Integer := 0; 483 484 Normalized_Compilation_Units : 485 Utils.Compilation_Unit_List_Access := null; 486 487 -- Clear -- 488 procedure Clear is 489 begin 490 Deallocate (Tree); 491 Deallocate (Elaborate_Tree); 492 Utils.Deallocate (Normalized_Compilation_Units); 493 end Clear; 358 494 begin 359 Asis.Implementation.Set_Status 360 (Not_Implemented_Error, "Elaboration_Order not implemented"); 361 raise Asis.Exceptions.ASIS_Failed; 362 363 return Nil_Relationship; 495 if Compilation_Units = Nil_Compilation_Unit_List then 496 return Nil_Relationship; 497 end if; 498 499 for Index in Compilation_Units'Range loop 500 Check_Compilation_Unit 501 (Compilation_Units (Index), The_Context, 502 "Elaboration_Order:Compilation_Unit"); 503 end loop; 504 505 Normalized_Compilation_Units := new 506 Asis.Compilation_Unit_List (1 .. Compilation_Units'Length); 507 508 Normalized_Compilation_Units.all := (others => Nil_Compilation_Unit); 509 510 Normalize (Compilation_Units, 511 Normalized_Compilation_Units, 512 Compilation_Units_Last); 513 514 Tree := Get_Needed_Units 515 (Normalized_Compilation_Units (1 .. Compilation_Units_Last), 516 The_Context); 517 518 Utils.Check (Tree, The_Context); 519 520 if Utils.Is_Have_Circular_Dependences (Tree) then 521 Clear; 522 523 Asis.Implementation.Set_Status 524 (Data_Error, "Elaboration_Order - " 525 & "Circular semantic dependence detected, can not create " 526 & "elaboration order"); 527 528 raise Asis.Exceptions.ASIS_Failed; 529 end if; 530 531 Elaborate_Tree := Utils.Create_Elaboration_Tree (Tree, The_Context); 532 533 declare 534 Relation : Relationship := Utils.Generate_Relationship 535 (Elaborate_Tree, null, 0); 536 begin 537 Clear; 538 return Relation; 539 end; 540 541 exception 542 when others => 543 Clear; 544 raise; 364 545 end Elaboration_Order; 365 546 … … 375 556 return Relationship 376 557 is 377 Current_Unit_Kind : Asis.Unit_Kinds;378 379 procedure Check_Compilation_Unit380 (Unit : in Compilation_Unit;381 Message : in Wide_String);382 383 procedure Normalize384 (List : in Asis.Compilation_Unit_List;385 Result : in Utils.Compilation_Unit_List_Access;386 Last : out ASIS_Integer);387 388 558 procedure Clear; 389 390 -- Check_Compilation_Unit --391 procedure Check_Compilation_Unit392 (Unit : in Compilation_Unit;393 Message : in Wide_String)394 is395 begin396 Current_Unit_Kind := Unit_Kind (Unit);397 398 if Current_Unit_Kind = Not_A_Unit399 or else Current_Unit_Kind = A_Nonexistent_Declaration400 or else Current_Unit_Kind = A_Nonexistent_Body401 or else Current_Unit_Kind = A_Configuration_Compilation402 then403 Asis.Implementation.Set_Status404 (Data_Error, "Semantic_Dependence_Order "405 & Message & " invalid unit " & Unit_Full_Name (Unit));406 407 raise Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit;408 end if;409 410 if not Asis.Ada_Environments.Is_Equal411 (Enclosing_Context (Unit), The_Context)412 then413 Asis.Implementation.Set_Status414 (Data_Error, "Semantic_Dependence_Order "415 & Message & " invalid unit's context " & Unit_Full_Name (Unit));416 417 raise Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit;418 end if;419 end Check_Compilation_Unit;420 559 421 560 Compilation_Units_Last : ASIS_Integer := 0; … … 429 568 Utils.Compilation_Unit_List_Access := null; 430 569 431 -- Normalize -- 432 procedure Normalize 433 (List : in Asis.Compilation_Unit_List; 434 Result : in Utils.Compilation_Unit_List_Access; 435 Last : out ASIS_Integer) 436 is 437 Unit : Compilation_Unit; 438 begin 439 Last := 0; 440 441 for Index in List'Range loop 442 Unit := List (Index); 443 444 if Assigned (Unit) 445 and then Unit_Kind (Unit) /= An_Unknown_Unit 446 then 447 if not Utils.In_List (Result, Last, Unit) then 448 Last := Last + 1; 449 Result (Last) := List (Index); 450 end if; 451 end if; 452 end loop; 453 end Normalize; 454 455 Tree : Utils.Tree_Node_Access := null; 570 Tree : Utils.Root_Tree_Access := null; 456 571 457 572 procedure Clear is begin … … 468 583 for Index in Compilation_Units'Range loop 469 584 Check_Compilation_Unit 470 (Compilation_Units (Index), "Compilation_Unit"); 585 (Compilation_Units (Index), The_Context, 586 "Semantic_Dependence_Order:Compilation_Unit"); 471 587 end loop; 472 588 … … 486 602 then 487 603 for Index in Dependent_Units'Range loop 488 Check_Compilation_Unit (Dependent_Units (Index), "Dependent_Unit"); 604 Check_Compilation_Unit 605 (Dependent_Units (Index), The_Context, 606 "Semantic_Dependence_Order:Dependent_Unit"); 489 607 end loop; 490 608 … … 553 671 (List : in Asis.Compilation_Unit_List; 554 672 The_Context : in Asis.Context) 555 return Utils. Tree_Node_Access673 return Utils.Root_Tree_Access 556 674 is 557 675 use Utils; … … 560 678 Kinds : Unit_Kinds; 561 679 562 Result : Tree_Node_Access := new Tree_Node;680 Result : Root_Tree_Access := new Root_Tree; 563 681 564 682 procedure Append_Node … … 577 695 Exist_Node : Tree_Node_Access; 578 696 begin 579 Exist_Node := Find (Result .all, Unit);697 Exist_Node := Find (Result, Unit); 580 698 581 699 if Exist_Node /= null then … … 625 743 Unit := List (Index); 626 744 627 if Find (Result .all, Unit) = null745 if Find (Result, Unit) = null 628 746 then 629 747 Kinds := Unit_Kind (Unit); … … 658 776 (List : in Asis.Compilation_Unit_List; 659 777 The_Context : in Asis.Context) 660 return Utils. Tree_Node_Access778 return Utils.Root_Tree_Access 661 779 is 662 780 use Utils; 663 781 664 Result : Tree_Node_Access := new Tree_Node;782 Result : Root_Tree_Access := new Root_Tree; 665 783 Unit : Compilation_Unit; 666 784 Second_Unit : Compilation_Unit; … … 688 806 begin 689 807 Kinds := Unit_Kind (Unit); 690 Exist_Node := Find (Result .all, Unit);808 Exist_Node := Find (Result, Unit); 691 809 Second_Unit := Nil_Compilation_Unit; 692 810 … … 806 924 Unit := Declarations_List (Index); 807 925 808 if Find (Result .all, Unit) = null then926 if Find (Result, Unit) = null then 809 927 Second_Unit := Corresponding_Body (Unit, The_Context); 810 928 … … 836 954 (List : in Asis.Compilation_Unit_List; 837 955 The_Context : in Asis.Context) 838 return Utils. Tree_Node_Access956 return Utils.Root_Tree_Access 839 957 is 840 958 use Utils; … … 843 961 Kinds : Unit_Kinds; 844 962 845 Result : Tree_Node_Access := new Tree_Node;963 Result : Root_Tree_Access := new Root_Tree; 846 964 Node : Tree_Node_Access := null; 847 965 … … 888 1006 Exist_Node : Tree_Node_Access; 889 1007 begin 890 Exist_Node := Find (Result .all, Unit);1008 Exist_Node := Find (Result, Unit); 891 1009 892 1010 if Exist_Node = null then … … 1049 1167 Retrive (Internal_Unit, Node); 1050 1168 else 1051 Exist_Node := Find (Result .all, Internal_Unit);1169 Exist_Node := Find (Result, Internal_Unit); 1052 1170 1053 1171 if Exist_Node = null then … … 1055 1173 1056 1174 if Node /= null then 1057 Add_Body_Dependents ( Exist_Node, Node);1175 Add_Body_Dependents (Result, Exist_Node, Node); 1058 1176 end if; 1059 1177 … … 1061 1179 else 1062 1180 if Node /= null then 1063 Add_Body_Dependents ( Exist_Node, Node);1181 Add_Body_Dependents (Result, Exist_Node, Node); 1064 1182 end if; 1065 1183 end if; … … 1090 1208 Exist_Node : Tree_Node_Access; 1091 1209 begin 1092 Exist_Node := Find (Result .all, Unit);1210 Exist_Node := Find (Result, Unit); 1093 1211 1094 1212 if Exist_Node = null then … … 1096 1214 1097 1215 if Node /= null then 1098 Add_Body_Dependents ( Exist_Node, Node);1216 Add_Body_Dependents (Result, Exist_Node, Node); 1099 1217 end if; 1100 1218 … … 1102 1220 else 1103 1221 if Node /= null then 1104 Add_Body_Dependents ( Exist_Node, Node);1222 Add_Body_Dependents (Result, Exist_Node, Node); 1105 1223 end if; 1106 1224 end if; … … 1133 1251 Unit := List (Index); 1134 1252 1135 if Find (Result .all, Unit) = null then1253 if Find (Result, Unit) = null then 1136 1254 Retrive (Unit, null, True); 1137 1255 end if; … … 1152 1270 (List : in Asis.Compilation_Unit_List; 1153 1271 The_Context : in Asis.Context) 1154 return Utils. Tree_Node_Access1272 return Utils.Root_Tree_Access 1155 1273 is 1156 1274 use Utils; 1157 1275 1158 Result : Tree_Node_Access := new Tree_Node;1276 Result : Root_Tree_Access := new Root_Tree; 1159 1277 1160 1278 Unit, Body_Unit : Compilation_Unit; … … 1176 1294 Second_Unit : Compilation_Unit; 1177 1295 begin 1178 Exist_Node := Find (Result .all, Unit);1296 Exist_Node := Find (Result, Unit); 1179 1297 Kinds := Unit_Kind (Unit); 1180 1298 … … 1199 1317 elsif Kinds in A_Library_Unit_Body then 1200 1318 if Exist_Node /= null then 1201 Add_Body_Dependents ( Exist_Node, Node);1319 Add_Body_Dependents (Result, Exist_Node, Node); 1202 1320 else 1203 1321 Second_Unit := Corresponding_Declaration (Unit, The_Context); … … 1206 1324 and then not Is_Identical (Second_Unit, Unit) 1207 1325 then 1208 Exist_Node := Find (Result .all, Second_Unit);1326 Exist_Node := Find (Result, Second_Unit); 1209 1327 1210 1328 if Exist_Node /= null then 1211 Add_Body_Dependents ( Exist_Node, Node);1329 Add_Body_Dependents (Result, Exist_Node, Node); 1212 1330 else 1213 1331 Exist_Node := Add_Child 1214 1332 (Result, null, Second_Unit, Unit, True); 1215 Add_Body_Dependents ( Exist_Node, Node);1333 Add_Body_Dependents (Result, Exist_Node, Node); 1216 1334 end if; 1217 1335 else 1218 1336 Exist_Node := Add_Child (Result, null, Unit); 1219 Add_Body_Dependents ( Exist_Node, Node);1337 Add_Body_Dependents (Result, Exist_Node, Node); 1220 1338 end if; 1221 1339 end if; … … 1223 1341 elsif Kinds in A_Subunit then 1224 1342 if Exist_Node /= null then 1225 Add_Body_Dependents ( Exist_Node, Node);1343 Add_Body_Dependents (Result, Exist_Node, Node); 1226 1344 else 1227 1345 Exist_Node := Add_Child (Result, null, Unit); 1228 Add_Body_Dependents ( Exist_Node, Node);1346 Add_Body_Dependents (Result, Exist_Node, Node); 1229 1347 end if; 1230 1348 … … 1352 1470 1353 1471 Kinds := Unit_Kind (Children); 1354 Exist_Node := Find (Result .all, Children);1472 Exist_Node := Find (Result, Children); 1355 1473 1356 1474 if Exist_Node /= null then … … 1500 1618 (Glued, Glued.all'Last, Next_Node) 1501 1619 then 1502 Next_Unit := Spec (Next_Node);1620 Next_Unit := Get_Spec (Next_Node); 1503 1621 Kinds := Unit_Kind (Next_Unit); 1504 1622 if Kinds in … … 1531 1649 Unit := List (Index); 1532 1650 1533 if Find (Result .all, Unit) = null then1651 if Find (Result, Unit) = null then 1534 1652 Kinds := Unit_Kind (Unit); 1535 1653 … … 1564 1682 (List : in Asis.Compilation_Unit_List; 1565 1683 The_Context : in Asis.Context) 1566 return Utils. Tree_Node_Access1684 return Utils.Root_Tree_Access 1567 1685 is 1568 1686 use Utils; 1569 1687 1570 Result : Tree_Node_Access := new Tree_Node;1688 Result : Root_Tree_Access := new Root_Tree; 1571 1689 1572 1690 Unit, Body_Unit : Compilation_Unit; … … 1606 1724 1607 1725 Kinds := Unit_Kind (Children); 1608 Exist_Node := Find (Result .all, Children);1726 Exist_Node := Find (Result, Children); 1609 1727 1610 1728 if Exist_Node /= null then … … 1682 1800 Next_Node := Next (Index); 1683 1801 1684 Next_Unit := Spec (Next_Node);1802 Next_Unit := Get_Spec (Next_Node); 1685 1803 Kinds := Unit_Kind (Next_Unit); 1686 1804 … … 1706 1824 Unit := List (Index); 1707 1825 1708 if Find (Result .all, Unit) = null then1826 if Find (Result, Unit) = null then 1709 1827 Kinds := Unit_Kind (Unit); 1710 1828 … … 1739 1857 (List : in Asis.Compilation_Unit_List; 1740 1858 The_Context : in Asis.Context) 1741 return Utils. Tree_Node_Access1859 return Utils.Root_Tree_Access 1742 1860 is 1743 1861 use Utils; 1744 1862 1745 Result : Tree_Node_Access := new Tree_Node;1863 Result : Root_Tree_Access := new Root_Tree; 1746 1864 1747 1865 Unit, Body_Unit : Compilation_Unit; … … 1793 1911 Exist_Node : Tree_Node_Access; 1794 1912 begin 1795 Exist_Node := Find (Result .all, Unit);1913 Exist_Node := Find (Result, Unit); 1796 1914 1797 1915 if Exist_Node = null then … … 1822 1940 end if; 1823 1941 1824 Ada.Wide_Text_IO.Put_Line ("Retrive :" & Unit_Full_Name (Unit));1825 1942 Kinds := Unit_Kind (Unit); 1826 1943 … … 1885 2002 1886 2003 Parent := Corresponding_Parent_Declaration (Unit, The_Context); 1887 Ada.Wide_Text_IO.Put_Line ("Parent:" & Unit_Full_Name (Parent));1888 2004 1889 2005 while Unit_Kind (Parent) in … … 1955 2071 1956 2072 if not Is_Nil (Sub_Unit) then 1957 Exist_Node := Find (Result .all, Sub_Unit);2073 Exist_Node := Find (Result, Sub_Unit); 1958 2074 if Exist_Node = null then 1959 2075 Exist_Node := Add_Child (Result, Node, Sub_Unit); … … 1988 2104 1989 2105 if not Is_Nil (Internal_Unit) then 1990 Ada.Wide_Text_IO.Put_Line ("With :" & Unit_Full_Name (Internal_Unit));1991 2106 if not For_Body then 1992 2107 Retrive (Internal_Unit, Node); 1993 2108 else 1994 Exist_Node := Find (Result .all, Internal_Unit);2109 Exist_Node := Find (Result, Internal_Unit); 1995 2110 1996 2111 if Exist_Node = null then … … 2004 2119 2005 2120 if Node /= null then 2006 Add_Body_Dependents ( Exist_Node, Node);2121 Add_Body_Dependents (Result, Exist_Node, Node); 2007 2122 end if; 2008 2123 … … 2010 2125 else 2011 2126 if Node /= null then 2012 Add_Body_Dependents ( Exist_Node, Node);2127 Add_Body_Dependents (Result, Exist_Node, Node); 2013 2128 end if; 2014 2129 end if; … … 2039 2154 Exist_Node : Tree_Node_Access; 2040 2155 begin 2041 Exist_Node := Find (Result .all, Unit);2156 Exist_Node := Find (Result, Unit); 2042 2157 2043 2158 if Exist_Node = null then … … 2051 2166 2052 2167 if Node /= null then 2053 Add_Body_Dependents ( Exist_Node, Node);2168 Add_Body_Dependents (Result, Exist_Node, Node); 2054 2169 end if; 2055 2170 … … 2057 2172 else 2058 2173 if Node /= null then 2059 Add_Body_Dependents ( Exist_Node, Node);2174 Add_Body_Dependents (Result, Exist_Node, Node); 2060 2175 end if; 2061 2176 end if; … … 2088 2203 Unit := List (Index); 2089 2204 2090 if Find (Result.all, Unit) = null then 2091 Ada.Wide_Text_IO.Put_Line ("Needed for :" & Unit_Full_Name (Unit)); 2205 if Find (Result, Unit) = null then 2092 2206 Retrive (Unit, null); 2093 2207 end if; … … 2107 2221 2108 2222 procedure Get_Subunits 2109 (Tree : in Utils. Tree_Node_Access;2223 (Tree : in Utils.root_Tree_Access; 2110 2224 Unit : in Compilation_Unit; 2111 2225 Node : in Utils.Tree_Node_Access; … … 2122 2236 2123 2237 if not Is_Nil (Sub_Unit) then 2124 Exist_Node := Find (Tree .all, Sub_Unit);2238 Exist_Node := Find (Tree, Sub_Unit); 2125 2239 if Exist_Node = null then 2126 2240 Exist_Node := Add_Child (Tree, Node, Sub_Unit); … … 2336 2450 2337 2451 procedure Dependence_Order 2338 (This : in Tree_Node_Access;2452 (This : in Root_Tree_Access; 2339 2453 Order : in Orders) 2340 2454 is … … 2348 2462 2349 2463 function Add_Child 2350 (This : in Tree_Node_Access;2464 (This : in Root_Tree_Access; 2351 2465 Node : in Tree_Node_Access; 2352 2466 Spec_Unit : in Compilation_Unit) 2353 2467 return Tree_Node_Access 2354 2468 is 2355 begin 2356 if This.Prev /= null then 2357 -- not root 2358 raise Use_Error; 2359 end if; 2360 2361 declare 2362 New_Node : Tree_Node_Access := new Tree_Node; 2363 begin 2364 New_Node.Unit := Spec_Unit; 2365 2366 if Node = null then 2367 This.Next := Add_Node (This.Next, New_Node.Self); 2368 New_Node.Prev := This.Self; 2369 else 2370 Node.Next := Add_Node (Node.Next, New_Node.Self); 2371 New_Node.Prev := Node.Self; 2372 end if; 2373 2374 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2375 return New_Node; 2376 end; 2469 New_Node : Tree_Node_Access := new Tree_Node; 2470 begin 2471 New_Node.Unit := Spec_Unit; 2472 2473 if Node = null then 2474 This.Next := Add_Node (This.Next, New_Node.Self); 2475 else 2476 Node.Next := Add_Node (Node.Next, New_Node.Self); 2477 New_Node.Prevs := Add_Node (New_Node.Prevs, Node.Self); 2478 end if; 2479 2480 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2481 return New_Node; 2377 2482 end Add_Child; 2378 2483 2379 2484 -- Add_Child -- 2380 2485 function Add_Child 2381