Commit 383b2b42 by Robert Dewar Committed by Arnaud Charlet

gprep.adb: Implement -C switch to scan comments

2005-11-14  Robert Dewar  <dewar@adacore.com>
	    Vincent Celier  <celier@adacore.com>

	* gprep.adb: Implement -C switch to scan comments

	* scng.adb: Scan comment symbol separately if Replace_In_Comments set

	* scans.ads: Comment updates (including new use of Tok_Comment in
	preprocessing)

	* opt.ads: Add documentation for flags that are used by gprmake,
	currently and in the next version of gprmake.
	(Verbosity_Level): New variable
	Add Replace_In_Comments switch

	* vms_data.ads: Add VMS equivalent for new gnatmake switches -vl, -vm
	and -vm.
	Add /REPLACE_IN_COMMENTS for gnatprep -C switch

From-SVN: r106983
parent 0bce6c77
...@@ -73,7 +73,7 @@ package body GPrep is ...@@ -73,7 +73,7 @@ package body GPrep is
File_Name_Buffer_Initial_Size : constant := 50; File_Name_Buffer_Initial_Size : constant := 50;
File_Name_Buffer : String_Access := File_Name_Buffer : String_Access :=
new String (1 .. File_Name_Buffer_Initial_Size); new String (1 .. File_Name_Buffer_Initial_Size);
-- A buffer to build output file names from input file names. -- A buffer to build output file names from input file names
----------------- -----------------
-- Subprograms -- -- Subprograms --
...@@ -102,7 +102,7 @@ package body GPrep is ...@@ -102,7 +102,7 @@ package body GPrep is
-- True if C is in 'a' .. 'z' or in 'A' .. 'Z' -- True if C is in 'a' .. 'z' or in 'A' .. 'Z'
procedure Double_File_Name_Buffer; procedure Double_File_Name_Buffer;
-- Double the size of the file name buffer. -- Double the size of the file name buffer
procedure Preprocess_Infile_Name; procedure Preprocess_Infile_Name;
-- When the specified output is a directory, preprocess the infile name -- When the specified output is a directory, preprocess the infile name
...@@ -116,12 +116,12 @@ package body GPrep is ...@@ -116,12 +116,12 @@ package body GPrep is
-- Process a -D switch on the command line -- Process a -D switch on the command line
procedure Put_Char_To_Outfile (C : Character); procedure Put_Char_To_Outfile (C : Character);
-- Output one character to the output file. -- Output one character to the output file. Used to initialize the
-- Used to initialize the preprocessor. -- preprocessor.
procedure New_EOL_To_Outfile; procedure New_EOL_To_Outfile;
-- Output a new line to the output file. -- Output a new line to the output file. Used to initialize the
-- Used to initialize the preprocessor. -- preprocessor.
procedure Scan_Command_Line; procedure Scan_Command_Line;
-- Scan the switches and the file names -- Scan the switches and the file names
...@@ -137,7 +137,7 @@ package body GPrep is ...@@ -137,7 +137,7 @@ package body GPrep is
begin begin
if not Copyright_Displayed then if not Copyright_Displayed then
Write_Line ("GNAT Preprocessor " & Gnatvsn.Gnat_Version_String); Write_Line ("GNAT Preprocessor " & Gnatvsn.Gnat_Version_String);
Write_Line ("Copyright 1996-2004 Free Software Foundation, Inc."); Write_Line ("Copyright 1996-2005, Free Software Foundation, Inc.");
Copyright_Displayed := True; Copyright_Displayed := True;
end if; end if;
end Display_Copyright; end Display_Copyright;
...@@ -198,21 +198,23 @@ package body GPrep is ...@@ -198,21 +198,23 @@ package body GPrep is
-- Test we had all the arguments needed -- Test we had all the arguments needed
if Infile_Name = No_Name then if Infile_Name = No_Name then
-- No input file specified, just output the usage and exit -- No input file specified, just output the usage and exit
Usage; Usage;
return; return;
elsif Outfile_Name = No_Name then elsif Outfile_Name = No_Name then
-- No output file specified, just output the usage and exit -- No output file specified, just output the usage and exit
Usage; Usage;
return; return;
end if; end if;
-- If a pragma Source_File_Name, we need to keep line numbers. -- If a pragma Source_File_Name, we need to keep line numbers. So, if
-- So, if the deleted lines are not put as comment, we must output them -- the deleted lines are not put as comment, we must output them as
-- as blank lines. -- blank lines.
if Source_Ref_Pragma and (not Opt.Comment_Deleted_Lines) then if Source_Ref_Pragma and (not Opt.Comment_Deleted_Lines) then
Opt.Blank_Deleted_Lines := True; Opt.Blank_Deleted_Lines := True;
...@@ -245,8 +247,7 @@ package body GPrep is ...@@ -245,8 +247,7 @@ package body GPrep is
end; end;
end if; end if;
-- If there are errors in the definition file, output these errors -- If there are errors in the definition file, output them and exit
-- and exit.
if Total_Errors_Detected > 0 then if Total_Errors_Detected > 0 then
Errutil.Finalize (Source_Type => "definition"); Errutil.Finalize (Source_Type => "definition");
...@@ -281,7 +282,6 @@ package body GPrep is ...@@ -281,7 +282,6 @@ package body GPrep is
-- rooted at the input directory. -- rooted at the input directory.
Process_Files; Process_Files;
end Gnatprep; end Gnatprep;
--------------------- ---------------------
...@@ -327,7 +327,7 @@ package body GPrep is ...@@ -327,7 +327,7 @@ package body GPrep is
procedure Preprocess_Infile_Name is procedure Preprocess_Infile_Name is
Len : Natural; Len : Natural;
First : Positive := 1; First : Positive;
Last : Natural; Last : Natural;
Symbol : Name_Id; Symbol : Name_Id;
Data : Symbol_Data; Data : Symbol_Data;
...@@ -346,6 +346,7 @@ package body GPrep is ...@@ -346,6 +346,7 @@ package body GPrep is
-- Look for possible symbols in the file name -- Look for possible symbols in the file name
First := 1;
while First < Len loop while First < Len loop
-- A symbol starts with a dollar sign followed by a letter -- A symbol starts with a dollar sign followed by a letter
...@@ -387,7 +388,7 @@ package body GPrep is ...@@ -387,7 +388,7 @@ package body GPrep is
declare declare
Sym_Len : constant Positive := Last - First + 1; Sym_Len : constant Positive := Last - First + 1;
Offset : constant Integer := Name_Len - Sym_Len; Offset : constant Integer := Name_Len - Sym_Len;
New_Len : constant Natural := Len + Offset; New_Len : constant Natural := Len + Offset;
begin begin
...@@ -465,7 +466,7 @@ package body GPrep is ...@@ -465,7 +466,7 @@ package body GPrep is
-- Outfile_Name. -- Outfile_Name.
procedure Recursive_Process (In_Dir : String; Out_Dir : String); procedure Recursive_Process (In_Dir : String; Out_Dir : String);
-- Process recursively files in In_Dir. Results go to Out_Dir. -- Process recursively files in In_Dir. Results go to Out_Dir
---------------------- ----------------------
-- Process_One_File -- -- Process_One_File --
...@@ -475,7 +476,7 @@ package body GPrep is ...@@ -475,7 +476,7 @@ package body GPrep is
Infile : Source_File_Index; Infile : Source_File_Index;
begin begin
-- Create the output file; fails if this does not work. -- Create the output file (fails if this does not work)
begin begin
Create (Text_Outfile, Out_File, Get_Name_String (Outfile_Name)); Create (Text_Outfile, Out_File, Get_Name_String (Outfile_Name));
...@@ -521,8 +522,7 @@ package body GPrep is ...@@ -521,8 +522,7 @@ package body GPrep is
Errutil.Finalize (Source_Type => "input"); Errutil.Finalize (Source_Type => "input");
end if; end if;
-- If we had some errors, delete the output file, and report -- If we had some errors, delete the output file, and report them
-- the errors.
if Err_Vars.Total_Errors_Detected > 0 then if Err_Vars.Total_Errors_Detected > 0 then
if Outfile /= Standard_Output then if Outfile /= Standard_Output then
...@@ -533,7 +533,7 @@ package body GPrep is ...@@ -533,7 +533,7 @@ package body GPrep is
OS_Exit (0); OS_Exit (0);
-- otherwise, close the output file, and we are done. -- Otherwise, close the output file, and we are done
elsif Outfile /= Standard_Output then elsif Outfile /= Standard_Output then
Close (Text_Outfile); Close (Text_Outfile);
...@@ -564,6 +564,8 @@ package body GPrep is ...@@ -564,6 +564,8 @@ package body GPrep is
Output_Directory := Out_Dir_Name; Output_Directory := Out_Dir_Name;
end Set_Directory_Names; end Set_Directory_Names;
-- Start of processing for Recursive_Process
begin begin
-- Open the current input directory -- Open the current input directory
...@@ -645,8 +647,11 @@ package body GPrep is ...@@ -645,8 +647,11 @@ package body GPrep is
end loop; end loop;
end Recursive_Process; end Recursive_Process;
-- Start of processing for Process_Files
begin begin
if Output_Directory = No_Name then if Output_Directory = No_Name then
-- If the output is not a directory, fail if the input is -- If the output is not a directory, fail if the input is
-- an existing directory, to avoid possible problems. -- an existing directory, to avoid possible problems.
...@@ -660,6 +665,7 @@ package body GPrep is ...@@ -660,6 +665,7 @@ package body GPrep is
Process_One_File; Process_One_File;
elsif Input_Directory = No_Name then elsif Input_Directory = No_Name then
-- Get the output file name from the input file name, and process -- Get the output file name from the input file name, and process
-- the single input file. -- the single input file.
...@@ -697,7 +703,8 @@ package body GPrep is ...@@ -697,7 +703,8 @@ package body GPrep is
loop loop
begin begin
Switch := GNAT.Command_Line.Getopt ("D: b c r s u v"); Switch := GNAT.Command_Line.Getopt ("D: b c C r s u v");
case Switch is case Switch is
when ASCII.NUL => when ASCII.NUL =>
...@@ -713,6 +720,9 @@ package body GPrep is ...@@ -713,6 +720,9 @@ package body GPrep is
when 'c' => when 'c' =>
Opt.Comment_Deleted_Lines := True; Opt.Comment_Deleted_Lines := True;
when 'C' =>
Opt.Replace_In_Comments := True;
when 'r' => when 'r' =>
Source_Ref_Pragma := True; Source_Ref_Pragma := True;
...@@ -780,6 +790,7 @@ package body GPrep is ...@@ -780,6 +790,7 @@ package body GPrep is
Write_Line ("gnatprep switches:"); Write_Line ("gnatprep switches:");
Write_Line (" -b Replace preprocessor lines by blank lines"); Write_Line (" -b Replace preprocessor lines by blank lines");
Write_Line (" -c Keep preprocessor lines as comments"); Write_Line (" -c Keep preprocessor lines as comments");
Write_Line (" -C Do symbol replacements within comments");
Write_Line (" -D Associate symbol with value"); Write_Line (" -D Associate symbol with value");
Write_Line (" -r Generate Source_Reference pragma"); Write_Line (" -r Generate Source_Reference pragma");
Write_Line (" -s Print a sorted list of symbol names and values"); Write_Line (" -s Print a sorted list of symbol names and values");
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
-- This package contains global flags set by the initialization routine from -- This package contains global flags set by the initialization routine from
-- the command line and referenced throughout the compiler, the binder, or -- the command line and referenced throughout the compiler, the binder, or
-- other GNAT tools. The comments indicate which options are used by which -- other GNAT tools. The comments indicate which options are used by which
-- programs (GNAT, GNATBIND, GNATMAKE, etc). -- programs (GNAT, GNATBIND, GNATLINK, GNATMAKE, GPRMAKE, etc).
with Gnatvsn; use Gnatvsn; with Gnatvsn; use Gnatvsn;
with Hostparm; use Hostparm; with Hostparm; use Hostparm;
...@@ -61,8 +61,12 @@ package Opt is ...@@ -61,8 +61,12 @@ package Opt is
-- Set True if binder file to be generated in Ada rather than C -- Set True if binder file to be generated in Ada rather than C
type Ada_Version_Type is (Ada_83, Ada_95, Ada_05); type Ada_Version_Type is (Ada_83, Ada_95, Ada_05);
pragma Warnings (Off, Ada_Version_Type);
-- Versions of Ada for Ada_Version below. Note that these are ordered, -- Versions of Ada for Ada_Version below. Note that these are ordered,
-- so that tests like Ada_Version >= Ada_95 are legitimate and useful. -- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
-- The Warnings_Off pragma stops warnings for Ada_Version >= Ada_05,
-- which we want to allow, so that things work OK when Ada_15 is added!
-- This warning is now removed, so this pragma can be removed some time???
Ada_Version_Default : Ada_Version_Type := Ada_95; Ada_Version_Default : Ada_Version_Type := Ada_95;
-- GNAT -- GNAT
...@@ -148,7 +152,7 @@ package Opt is ...@@ -148,7 +152,7 @@ package Opt is
-- it ON. It is set ON when Tree_Output is set ON, it can also be set ON -- it ON. It is set ON when Tree_Output is set ON, it can also be set ON
-- from the code of GNSA-based tool (a client may need to set ON the -- from the code of GNSA-based tool (a client may need to set ON the
-- Back_Annotate_Rep_Info flag in this case. At the moment this does not -- Back_Annotate_Rep_Info flag in this case. At the moment this does not
-- make very much sense, because GNSA can not do back annotation). -- make very much sense, because GNSA cannot do back annotation).
Back_Annotate_Rep_Info : Boolean := False; Back_Annotate_Rep_Info : Boolean := False;
-- GNAT -- GNAT
...@@ -173,7 +177,7 @@ package Opt is ...@@ -173,7 +177,7 @@ package Opt is
-- building a library. May be set to True by Gnatbind.Scan_Bind_Arg. -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
Bind_Only : Boolean := False; Bind_Only : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Set to True to skip compile and link steps -- Set to True to skip compile and link steps
-- (except when Compile_Only and/or Link_Only are True). -- (except when Compile_Only and/or Link_Only are True).
...@@ -218,7 +222,7 @@ package Opt is ...@@ -218,7 +222,7 @@ package Opt is
-- directly modified by gnatmake, to affect the shared binder routines. -- directly modified by gnatmake, to affect the shared binder routines.
Check_Switches : Boolean := False; Check_Switches : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Set to True to check compiler options during the make process -- Set to True to check compiler options during the make process
Check_Unreferenced : Boolean := False; Check_Unreferenced : Boolean := False;
...@@ -242,9 +246,9 @@ package Opt is ...@@ -242,9 +246,9 @@ package Opt is
-- in the output file. -- in the output file.
Compile_Only : Boolean := False; Compile_Only : Boolean := False;
-- GNATMAKE, GNATCLEAN -- GNATMAKE, GNATCLEAN, GPRMAKE
-- GNATMAKE: set to True to skip bind and link steps (except when -- GNATMAKE, GPRMAKE: set to True to skip bind and link steps (except when
-- Bind_Only is True). -- Bind_Only is True).
-- GNATCLEAN: set to True to only the files produced by the compiler are to -- GNATCLEAN: set to True to only the files produced by the compiler are to
-- be deleted, but not the library files or executable files. -- be deleted, but not the library files or executable files.
...@@ -268,9 +272,9 @@ package Opt is ...@@ -268,9 +272,9 @@ package Opt is
-- Set to True to activate warnings on constant conditions -- Set to True to activate warnings on constant conditions
Create_Mapping_File : Boolean := False; Create_Mapping_File : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Set to True (-C switch) to indicate that gnatmake will invoke -- Set to True (-C switch) to indicate that the compiler will be invoked
-- the compiler with a mapping file (-gnatem compiler switch). -- with a mapping file (-gnatem compiler switch).
Debug_Pragmas_Enabled : Boolean := False; Debug_Pragmas_Enabled : Boolean := False;
-- GNAT -- GNAT
...@@ -309,7 +313,7 @@ package Opt is ...@@ -309,7 +313,7 @@ package Opt is
-- potentially blocking operations are detected from protected actions. -- potentially blocking operations are detected from protected actions.
Display_Compilation_Progress : Boolean := False; Display_Compilation_Progress : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Set True (-d switch) to display information on progress while compiling -- Set True (-d switch) to display information on progress while compiling
-- files. Internal flag to be used in conjunction with an IDE (e.g GPS). -- files. Internal flag to be used in conjunction with an IDE (e.g GPS).
...@@ -451,11 +455,11 @@ package Opt is ...@@ -451,11 +455,11 @@ package Opt is
-- (-F switch set). -- (-F switch set).
Force_Compilations : Boolean := False; Force_Compilations : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Set to force recompilations even when the objects are up-to-date. -- Set to force recompilations even when the objects are up-to-date.
Full_Path_Name_For_Brief_Errors : Boolean := False; Full_Path_Name_For_Brief_Errors : Boolean := False;
-- GNAT, GNATMAKE, GNATCLEAN -- GNAT, GNATMAKE, GNATCLEAN, GPRMAKE
-- When True, in Brief_Output mode, each error message line -- When True, in Brief_Output mode, each error message line
-- will start with the full path name of the source. -- will start with the full path name of the source.
-- When False, only the file name without directory information -- When False, only the file name without directory information
...@@ -566,8 +570,8 @@ package Opt is ...@@ -566,8 +570,8 @@ package Opt is
-- if not. -- if not.
Keep_Going : Boolean := False; Keep_Going : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- When True signals gnatmake to ignore compilation errors and keep -- When True signals to ignore compilation errors and keep
-- processing sources until there is no more work. -- processing sources until there is no more work.
Keep_Temporary_Files : Boolean := False; Keep_Temporary_Files : Boolean := False;
...@@ -576,7 +580,7 @@ package Opt is ...@@ -576,7 +580,7 @@ package Opt is
-- deleted. Set by switch -dn or qualifier /KEEP_TEMPORARY_FILES. -- deleted. Set by switch -dn or qualifier /KEEP_TEMPORARY_FILES.
Link_Only : Boolean := False; Link_Only : Boolean := False;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Set to True to skip compile and bind steps -- Set to True to skip compile and bind steps
-- (except when Bind_Only is set to True). -- (except when Bind_Only is set to True).
...@@ -693,7 +697,7 @@ package Opt is ...@@ -693,7 +697,7 @@ package Opt is
-- Column_Number'Last during scanning of configuration pragma files. -- Column_Number'Last during scanning of configuration pragma files.
Maximum_Processes : Positive := 1; Maximum_Processes : Positive := 1;
-- GNATMAKE -- GNATMAKE, GPRMAKE
-- Maximum number of processes that should be spawned to carry out -- Maximum number of processes that should be spawned to carry out
-- compilations. -- compilations.
...@@ -762,11 +766,11 @@ package Opt is ...@@ -762,11 +766,11 @@ package Opt is
-- This constant reflects the optimization level (0,1,2 for -O0,-O1,-O2) -- This constant reflects the optimization level (0,1,2 for -O0,-O1,-O2)
Output_File_Name_Present : Boolean := False; Output_File_Name_Present : Boolean := False;
-- GNATBIND, GNAT, GNATMAKE -- GNATBIND, GNAT, GNATMAKE, GPRMAKE
-- Set to True when the output C file name is given with option -o -- Set to True when the output C file name is given with option -o
-- for GNATBIND, when the object file name is given with option -- for GNATBIND, when the object file name is given with option
-- -gnatO for GNAT or when the executable is given with option -o -- -gnatO for GNAT or when the executable is given with option -o
-- for GNATMAKE. -- for GNATMAKE or GPRMAKE.
Output_Linker_Option_List : Boolean := False; Output_Linker_Option_List : Boolean := False;
-- GNATBIND -- GNATBIND
...@@ -829,10 +833,14 @@ package Opt is ...@@ -829,10 +833,14 @@ package Opt is
-- used if the policy is set in package System. -- used if the policy is set in package System.
Quiet_Output : Boolean := False; Quiet_Output : Boolean := False;
-- GNATMAKE, GNATCLEAN, GPR2MAKE -- GNATMAKE, GNATCLEAN, GPRMAKE
-- Set to True if the tool should not have any output if there are no -- Set to True if the tool should not have any output if there are no
-- errors or warnings. -- errors or warnings.
Replace_In_Comments : Boolean := False;
-- GNATPREP
-- Set to True if -C switch used
RTS_Lib_Path_Name : String_Ptr := null; RTS_Lib_Path_Name : String_Ptr := null;
RTS_Src_Path_Name : String_Ptr := null; RTS_Src_Path_Name : String_Ptr := null;
-- GNAT -- GNAT
...@@ -1017,17 +1025,33 @@ package Opt is ...@@ -1017,17 +1025,33 @@ package Opt is
-- This flag determines if validity checking is on or off. The initial -- This flag determines if validity checking is on or off. The initial
-- state is on, and the required default validity checks are active. The -- state is on, and the required default validity checks are active. The
-- actual set of checks that is performed if Validity_Checks_On is set is -- actual set of checks that is performed if Validity_Checks_On is set is
-- defined by the switches in package Sem_Val. The Validity_Checks_On flag -- defined by the switches in package Validsw. The Validity_Checks_On flag
-- is controlled by pragma Validity_Checks (On | Off), and also some -- is controlled by pragma Validity_Checks (On | Off), and also some
-- generated compiler code (typically code that has to do with validity -- generated compiler code (typically code that has to do with validity
-- check generation) is compiled with this flag set to False. This flag is -- check generation) is compiled with this flag set to False. This flag is
-- set to False by the -gnatp switch. -- set to False by the -gnatp switch.
Verbose_Mode : Boolean := False; Verbose_Mode : Boolean := False;
-- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN,
-- GPRMAKE
-- Set to True to get verbose mode (full error message text and location -- Set to True to get verbose mode (full error message text and location
-- information sent to standard output, also header, copyright and summary) -- information sent to standard output, also header, copyright and summary)
type Verbosity_Level_Type is (None, Low, Medium, High);
Verbosity_Level : Verbosity_Level_Type := High;
-- GNATMAKE, GPRMAKE
-- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates
-- the level of verbosity of informational messages:
--
-- In Low Verbosity, the reasons why a source is recompiled, the name
-- of the executable and the reason it must be rebuilt is output.
--
-- In Medium Verbosity, additional lines are output for each ALI file
-- that is checked.
--
-- In High Verbosity, additional lines are output when the ALI file
-- is part of an Ada library, is read-only or is part of the runtime.
Warn_On_Ada_2005_Compatibility : Boolean := True; Warn_On_Ada_2005_Compatibility : Boolean := True;
-- GNAT -- GNAT
-- Set to True to active all warnings on Ada 2005 compatibility issues, -- Set to True to active all warnings on Ada 2005 compatibility issues,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -190,22 +190,27 @@ package Scans is ...@@ -190,22 +190,27 @@ package Scans is
Tok_Dot_Dot, -- .. Sterm, Chtok Tok_Dot_Dot, -- .. Sterm, Chtok
-- The following three entries are used only when scanning project
-- files.
Tok_Project, Tok_Project,
Tok_Extends, Tok_Extends,
Tok_External, Tok_External,
Tok_Comment, -- These three entries represent keywords for the project file language
-- and can be returned only in the case of scanning project files.
-- The following entry is used by the preprocessor and when scanning Tok_Comment,
-- project files. -- This entry is used when scanning project files (where it represents
-- an entire comment), and in preprocessing with the -C switch set
-- (where it represents just the "--" of a comment). For the project
-- file case, the text of the comment is stored in
Tok_End_Of_Line, Tok_End_Of_Line,
-- Represents an end of line. Not used during normal compilation scans
-- The following entry is used by the preprocessor -- where end of line is ignored. Active for preprocessor scanning and
-- also when scanning project files (where it is neede because of ???)
Tok_Special, Tok_Special,
-- Used only in preprocessor scanning (to represent one of the
-- characters '#', '$', '?', '@', '`', '\', '^', '~', or '_'. The
-- character value itself is stored in Scans.Special_Character.
No_Token); No_Token);
-- No_Token is used for initializing Token values to indicate that -- No_Token is used for initializing Token values to indicate that
...@@ -394,7 +399,7 @@ package Scans is ...@@ -394,7 +399,7 @@ package Scans is
-- We do things this way to minimize the impact on comment scanning. -- We do things this way to minimize the impact on comment scanning.
Character_Code : Char_Code; Character_Code : Char_Code;
-- Valid only when Token is Tok_Char_Literal. -- Valid only when Token is Tok_Char_Literal
Real_Literal_Value : Ureal; Real_Literal_Value : Ureal;
-- Valid only when Token is Tok_Real_Literal -- Valid only when Token is Tok_Real_Literal
...@@ -411,11 +416,17 @@ package Scans is ...@@ -411,11 +416,17 @@ package Scans is
-- Valid only when Token = Tok_String_Literal. -- Valid only when Token = Tok_String_Literal.
Special_Character : Character; Special_Character : Character;
-- Valid only when Token = Tok_Special -- Valid only when Token = Tok_Special. Returns one of the characters
-- '#', '$', '?', '@', '`', '\', '^', '~', or '_'.
--
-- Why only this set? What about wide characters???
Comment_Id : Name_Id := No_Name; Comment_Id : Name_Id := No_Name;
-- Valid only when Token = Tok_Comment. Store the string that follows -- Valid only when Token = Tok_Comment. Store the string that follows
-- the two '-' of a comment. -- the "--" of a comment when scanning project files.
--
-- Is it really right for this to be a Name rather than a String, what
-- about the case of Wide_Wide_Characters???
-------------------------------------------------------- --------------------------------------------------------
-- Procedures for Saving and Restoring the Scan State -- -- Procedures for Saving and Restoring the Scan State --
......
...@@ -1465,6 +1465,17 @@ package body Scng is ...@@ -1465,6 +1465,17 @@ package body Scng is
else -- Source (Scan_Ptr + 1) = '-' then else -- Source (Scan_Ptr + 1) = '-' then
if Style_Check then Style.Check_Comment; end if; if Style_Check then Style.Check_Comment; end if;
Scan_Ptr := Scan_Ptr + 2; Scan_Ptr := Scan_Ptr + 2;
-- If we are in preprocessor mode with Replace_In_Comments set,
-- then we return the "--" as a token on its own.
if Replace_In_Comments then
Token := Tok_Comment;
return;
end if;
-- Otherwise scan out the comment
Start_Of_Comment := Scan_Ptr; Start_Of_Comment := Scan_Ptr;
-- Loop to scan comment (this loop runs more than once only if -- Loop to scan comment (this loop runs more than once only if
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1996-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -3760,6 +3760,14 @@ package VMS_Data is ...@@ -3760,6 +3760,14 @@ package VMS_Data is
-- /VERBOSE), then error lines start with the full path name of the -- /VERBOSE), then error lines start with the full path name of the
-- project file, rather than its simple file name. -- project file, rather than its simple file name.
S_Make_Hi_Verb : aliased constant S := "/HIGH_VERBOSITY " &
"-vh";
-- /NOHIGH_VERBOSITY (D)
-- /HIGH_VERBOSITY
--
-- Displays the reason for all recompilations GNAT MAKE decides are
-- necessary, in high verbosity. Equivalent to /VERBOSE.
S_Make_Inplace : aliased constant S := "/IN_PLACE " & S_Make_Inplace : aliased constant S := "/IN_PLACE " &
"-i"; "-i";
-- /NOIN_PLACE (D) -- /NOIN_PLACE (D)
...@@ -3798,6 +3806,15 @@ package VMS_Data is ...@@ -3798,6 +3806,15 @@ package VMS_Data is
-- /COMPILER_QUALIFIERS, /BINDER_QUALIFIERS and /MAKE_QUALIFIERS will be -- /COMPILER_QUALIFIERS, /BINDER_QUALIFIERS and /MAKE_QUALIFIERS will be
-- passed to any GNAT LINK commands generated by GNAT LINK. -- passed to any GNAT LINK commands generated by GNAT LINK.
S_Make_Low_Verb : aliased constant S := "/LOW_VERBOSITY " &
"-vl";
-- /NOLOW_VERBOSITY (D)
-- /LOW_VERBOSITY
--
-- Displays the reason for all recompilations GNAT MAKE decides are
-- necessary, in low verbosity, that is with less output than
-- /MEDIUM_VERBOSITY, /HIGH_VERBOSITY or /VERBOSE.
S_Make_Make : aliased constant S := "/MAKE_QUALIFIERS=?" & S_Make_Make : aliased constant S := "/MAKE_QUALIFIERS=?" &
"-margs MAKE"; "-margs MAKE";
-- /MAKE_QUALIFIERS -- /MAKE_QUALIFIERS
...@@ -3822,6 +3839,15 @@ package VMS_Data is ...@@ -3822,6 +3839,15 @@ package VMS_Data is
-- the mapping file. This will improve the source search during the next -- the mapping file. This will improve the source search during the next
-- invocations of the compiler -- invocations of the compiler
S_Make_Med_Verb : aliased constant S := "/MEDIUM_VERBOSITY " &
"-vm";
-- /NOMEDIUM_VERBOSITY (D)
-- /MEDIUM_VERBOSITY
--
-- Displays the reason for all recompilations GNAT MAKE decides are
-- necessary, in medium verbosity, that is with potentially less output
-- than /HIGH_VERBOSITY or /VERBOSE.
S_Make_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" & S_Make_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" &
"DEFAULT " & "DEFAULT " &
"-vP0 " & "-vP0 " &
...@@ -4017,12 +4043,15 @@ package VMS_Data is ...@@ -4017,12 +4043,15 @@ package VMS_Data is
S_Make_Ext 'Access, S_Make_Ext 'Access,
S_Make_Force 'Access, S_Make_Force 'Access,
S_Make_Full 'Access, S_Make_Full 'Access,
S_Make_Hi_Verb 'Access,
S_Make_Inplace 'Access, S_Make_Inplace 'Access,
S_Make_Index 'Access, S_Make_Index 'Access,
S_Make_Library 'Access, S_Make_Library 'Access,
S_Make_Link 'Access, S_Make_Link 'Access,
S_Make_Low_Verb'Access,
S_Make_Make 'Access, S_Make_Make 'Access,
S_Make_Mapping 'Access, S_Make_Mapping 'Access,
S_Make_Med_Verb'Access,
S_Make_Mess 'Access, S_Make_Mess 'Access,
S_Make_Minimal 'Access, S_Make_Minimal 'Access,
S_Make_Nolink 'Access, S_Make_Nolink 'Access,
...@@ -4452,6 +4481,14 @@ package VMS_Data is ...@@ -4452,6 +4481,14 @@ package VMS_Data is
-- Preprocessor lines and deleted lines are completely removed from the -- Preprocessor lines and deleted lines are completely removed from the
-- output. -- output.
S_Prep_Replace : aliased constant S := "/REPLACE_IN_COMMENTS " &
"-C";
-- /NOREPLACE_IN_COMMENTS (D)
-- /REPLACE_IN_COMMENTS
--
-- Causes preprocessor to scan comments and perform replacements on
-- any $symbol occurrences within the comment text.
S_Prep_Symbols : aliased constant S := "/SYMBOLS " & S_Prep_Symbols : aliased constant S := "/SYMBOLS " &
"-s"; "-s";
-- /NOSYMBOLS (D) -- /NOSYMBOLS (D)
...@@ -4471,6 +4508,7 @@ package VMS_Data is ...@@ -4471,6 +4508,7 @@ package VMS_Data is
S_Prep_Com 'Access, S_Prep_Com 'Access,
S_Prep_Ref 'Access, S_Prep_Ref 'Access,
S_Prep_Remove 'Access, S_Prep_Remove 'Access,
S_Prep_Replace 'Access,
S_Prep_Symbols 'Access, S_Prep_Symbols 'Access,
S_Prep_Undef 'Access); S_Prep_Undef 'Access);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment