⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ghdlprint.adb

📁 vhdl集成电路设计软件.需要用gcc-4.0.2版本编译.
💻 ADB
📖 第 1 页 / 共 4 页
字号:
      Xrefs.Sort_By_Location;      if False then         for I in 1 .. Xrefs.Get_Last_Xref loop            declare               use Xrefs;               procedure Put_Loc (L : Location_Type)               is                  use Files_Map;                  L_File : Source_File_Entry;                  L_Pos : Source_Ptr;               begin                  Files_Map.Location_To_File_Pos (L, L_File, L_Pos);                  Put_Nat (Natural (L_File));                  --Image (Get_File_Name (L_File));                  --Put (Name_Buffer (1 .. Name_Length));                  Put (":");                  Put_Nat (Natural (L_Pos));               end Put_Loc;            begin               Put_Loc (Get_Xref_Location (I));               case Get_Xref_Kind (I) is                  when Xref_Decl =>                     Put (" decl ");                     Put (Image (Get_Identifier (Get_Xref_Node (I))));                  when Xref_Ref =>                     Put (" use ");                     Put_Loc (Get_Location (Get_Xref_Node (I)));                  when Xref_End =>                     Put (" end ");                  when Xref_Body =>                     Put (" body ");               end case;               New_Line;            end;         end loop;      end if;      --  Create filexref_info.      Filexref_Info := new Filexref_Info_Arr        (No_Source_File_Entry .. Files_Map.Get_Last_Source_File_Entry);      Filexref_Info.all := (others => (Output => null,                                       Referenced => False));      for I in Files'Range loop         Filexref_Info (Files (I).Fe).Output := Files (I).Output;      end loop;      Prev_Output := Current_Input;      for I in Files'Range loop         if Cmd.Output_Dir /= null then            Create (Output, Out_File,                    Cmd.Output_Dir.all & Directory_Separator                    & Files (I).Output.all);            Set_Output (Output);         end if;         Put_Html_Header;         Put_Line ("  <title>");         Put_Html (Files_Name (I).all);         Put ("</title>");         Put_Line ("</head>");         New_Line;         Put_Line ("<body>");         Put ("<h1>");         Put_Html (Files_Name (I).all);         Put ("</h1>");         New_Line;         PP_Html_File (Files (I).Fe);         Put_Html_Foot;         if Cmd.Output_Dir /= null then            Close (Output);         end if;      end loop;      --  Create indexes.      if Cmd.Output_Dir /= null then         Create (Output, Out_File,                 Cmd.Output_Dir.all & Directory_Separator & "index.html");         Set_Output (Output);         Put_Html_Header;         Put_Line ("  <title>Xrefs indexes</title>");         Put_Line ("</head>");         New_Line;         Put_Line ("<body>");         Put_Line ("<p>list of files:");         Put_Line ("<ul>");         for I in Files'Range loop            Put ("<li>");            Put ("<a href=""");            Put (Files (I).Output.all);            Put (""">");            Put_Html (Files_Name (I).all);            Put ("</a>");            Put ("</li>");            New_Line;         end loop;         Put_Line ("</ul></p>");         Put_Line ("<hr>");         --  TODO: list of design units.         Put_Line ("<p>list of files referenced but not available:");         Put_Line ("<ul>");         for I in No_Source_File_Entry + 1 .. Filexref_Info'Last loop            if Filexref_Info (I).Output = null              and then Filexref_Info (I).Referenced            then               Put ("<li><a name=""f");               Put_Nat (Natural (I));               Put (""">");               Put_Html (Image (Files_Map.Get_File_Name (I)));               Put ("</a></li>");               New_Line;            end if;         end loop;         Put_Line ("</ul></p><hr>");         Put_Html_Foot;         Close (Output);      end if;      if Html_Format = Html_Css        and then Cmd.Output_Dir /= null      then         declare            Css_Filename : String :=              Cmd.Output_Dir.all & Directory_Separator & "ghdl.css";         begin            if not Is_Regular_File (Css_Filename & Nul) then               Create (Output, Out_File, Css_Filename);               Set_Output (Output);               Put_Css;               Close (Output);            end if;         end;      end if;   exception      when Compilation_Error =>         Error ("xrefs has failed due to compilation error");   end Perform_Action;   --  Command --xref   type Command_Xref is new Command_Lib with null record;   function Decode_Command (Cmd : Command_Xref; Name : String)                           return Boolean;   function Get_Short_Help (Cmd : Command_Xref) return String;   procedure Perform_Action (Cmd : in out Command_Xref;                             Files_Name : Argument_List);   function Decode_Command (Cmd : Command_Xref; Name : String)                           return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "--xref";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Xref) return String   is      pragma Unreferenced (Cmd);   begin      return "--xref FILEs  Generate xrefs";   end Get_Short_Help;   procedure Perform_Action     (Cmd : in out Command_Xref; Files_Name : Argument_List)   is      pragma Unreferenced (Cmd);      use Files_Map;      Id : Name_Id;      File : Source_File_Entry;      type File_Data is record         Fe : Source_File_Entry;         Design_File : Iir;      end record;      type File_Data_Array is array (Files_Name'Range) of File_Data;      Files : File_Data_Array;   begin      --  Load work library.      Setup_Libraries (True);      Xrefs.Init;      Flags.Flag_Xref := True;      --  Parse all files.      for I in Files'Range loop         Id := Get_Identifier (Files_Name (I).all);         File := Load_Source_File (Libraries.Local_Directory, Id);         if File = No_Source_File_Entry then            Error ("cannot open " & Image (Id));            return;         end if;         Files (I).Fe := File;         Files (I).Design_File := Libraries.Load_File (File);         if Files (I).Design_File = Null_Iir then            return;         end if;         --  Put units in library.         --  Note: design_units stay while design_file get empty.         Libraries.Add_Design_File_Into_Library (Files (I).Design_File);      end loop;      --  Analyze all files.      for I in Files'Range loop         Analyze_Design_File_Units (Files (I).Design_File);      end loop;      Xrefs.Fix_End_Xrefs;      Xrefs.Sort_By_Node_Location;      for F in Files'Range loop         Put ("GHDL-XREF V0");         declare            use Xrefs;            Cur_Decl : Iir;            Cur_File : Source_File_Entry;            procedure Emit_Loc (Loc : Location_Type; C : Character)            is               L_File : Source_File_Entry;               L_Pos : Source_Ptr;               L_Line : Natural;               L_Off : Natural;            begin               Location_To_Coord (Loc, L_File, L_Pos, L_Line, L_Off);               --Put_Nat (Natural (L_File));               --Put (':');               Put_Nat (L_Line);               Put (C);               Put_Nat (L_Off);            end Emit_Loc;            procedure Emit_Decl (N : Iir)            is               Loc : Location_Type;               Loc_File : Source_File_Entry;               Loc_Pos : Source_Ptr;               C : Character;            begin               New_Line;               Cur_Decl := N;               Loc := Get_Location (N);               Location_To_File_Pos (Loc, Loc_File, Loc_Pos);               if Loc_File /= Cur_File then                  Cur_File := Loc_File;                  Put ("XFILE: ");                  Image (Get_Source_File_Directory (Cur_File));                  Put (Name_Buffer (1 .. Name_Length));                  Image (Get_File_Name (Cur_File));                  Put (Name_Buffer (1 .. Name_Length));                  New_Line;               end if;               --  Letters:               --   b d fgh jk  no qr  uvwxyz               --     D   H JK MNO QR  U WXYZ               case Get_Kind (N) is                  when Iir_Kind_Type_Declaration =>                     C := 'T';                  when Iir_Kind_Subtype_Declaration =>                     C := 't';                  when Iir_Kind_Entity_Declaration =>                     C := 'E';                  when Iir_Kind_Architecture_Declaration =>                     C := 'A';                  when Iir_Kind_Library_Declaration =>                     C := 'L';                  when Iir_Kind_Package_Declaration =>                     C := 'P';                  when Iir_Kind_Package_Body =>                     C := 'B';                  when Iir_Kind_Function_Declaration =>                     C := 'F';                  when Iir_Kind_Procedure_Declaration =>                     C := 'p';                  when Iir_Kind_Signal_Interface_Declaration =>                     C := 's';                  when Iir_Kind_Signal_Declaration =>                     C := 'S';                  when Iir_Kind_Constant_Interface_Declaration =>                     C := 'c';                  when Iir_Kind_Constant_Declaration =>                     C := 'C';                  when Iir_Kind_Variable_Declaration =>                     C := 'V';                  when Iir_Kind_Element_Declaration =>                     C := 'e';                  when Iir_Kind_Iterator_Declaration =>                     C := 'i';                  when Iir_Kind_Attribute_Declaration =>                     C := 'a';                  when Iir_Kind_Enumeration_Literal =>                     C := 'l';                  when Iir_Kind_Component_Declaration =>                     C := 'm';                  when Iir_Kind_Component_Instantiation_Statement =>                     C := 'I';                  when Iir_Kind_Generate_Statement =>                     C := 'G';                  when others =>                     C := '?';               end case;               Emit_Loc (Loc, C);               --Disp_Tree.Disp_Iir_Address (N);               Put (' ');               case Get_Kind (N) is                  when Iir_Kind_Function_Body                    | Iir_Kind_Procedure_Body =>                     null;                  when others =>                     Image (Get_Identifier (N));                     Put (Name_Buffer (1 .. Name_Length));               end case;            end Emit_Decl;            procedure Emit_Ref (R : Xref; T : Character)            is               N : Iir;            begin               N := Get_Xref_Node (R);               if N /= Cur_Decl then                  Emit_Decl (N);               end if;               Put (' ');               Emit_Loc (Get_Xref_Location (R), T);            end Emit_Ref;            Loc : Location_Type;            Loc_File : Source_File_Entry;            Loc_Pos : Source_Ptr;         begin            Cur_Decl := Null_Iir;            Cur_File := No_Source_File_Entry;            for I in First_Xref .. Get_Last_Xref loop               Loc := Get_Xref_Location (I);               Location_To_File_Pos (Loc, Loc_File, Loc_Pos);               if Loc_File = Files (F).Fe then                  --  This is a local location.                  case Get_Xref_Kind (I) is                     when Xref_Decl =>                        Emit_Decl (Get_Xref_Node (I));                     when Xref_End =>                        Emit_Ref (I, 'e');                     when Xref_Ref =>                        Emit_Ref (I, 'r');                     when Xref_Body =>                        Emit_Ref (I, 'b');                     when others =>                        null;                  end case;               end if;            end loop;            New_Line;         end;      end loop;   exception      when Compilation_Error =>         Error ("xrefs has failed due to compilation error");   end Perform_Action;   procedure Register_Commands is   begin      Register_Command (new Command_Chop);      Register_Command (new Command_Lines);      Register_Command (new Command_PP_Html);      Register_Command (new Command_Xref_Html);      Register_Command (new Command_Xref);   end Register_Commands;end Ghdlprint;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -