浏览代码

* message loading fixes from Sergey (merged)

peter 24 年之前
父节点
当前提交
939f49375f
共有 4 个文件被更改,包括 43 次插入34 次删除
  1. 2 2
      compiler/msg/errore.msg
  2. 1 1
      compiler/msgtxt.inc
  3. 13 28
      compiler/options.pas
  4. 27 3
      compiler/verbose.pas

+ 2 - 2
compiler/msg/errore.msg

@@ -1740,7 +1740,7 @@ option_too_many_cfg_files=11008_F_Too many config files nested
 % You can only nest up to 16 config files.
 % You can only nest up to 16 config files.
 option_unable_open_file=11009_F_Unable to open file $1
 option_unable_open_file=11009_F_Unable to open file $1
 % The option file cannot be found.
 % The option file cannot be found.
-option_reading_further_from=11010_N_Reading further options from $1
+option_reading_further_from=11010_D_Reading further options from $1
 % Displayed when you have notes turned on, and the compiler switches
 % Displayed when you have notes turned on, and the compiler switches
 % to another options file.
 % to another options file.
 option_target_is_already_set=11011_W_Target is already set to: $1
 option_target_is_already_set=11011_W_Target is already set to: $1
@@ -1788,7 +1788,7 @@ option_using_env=11027_T_Reading options from environment $1
 % Options are also read from this environment string
 % Options are also read from this environment string
 option_handling_option=11028_D_Handling option "$1"
 option_handling_option=11028_D_Handling option "$1"
 % Debug info that an option is found and will be handled
 % Debug info that an option is found and will be handled
-option_help_press_enter=11029__*** press enter ***
+option_help_press_enter=11029__*** press enter ***
 %\end{description}
 %\end{description}
 # EndOfTeX
 # EndOfTeX
 
 

+ 1 - 1
compiler/msgtxt.inc

@@ -614,7 +614,7 @@ const msgtxt : array[0..000136,1..240] of char=(
   '11007_H_-? writes help pages'#000+
   '11007_H_-? writes help pages'#000+
   '11008_F_Too many config files nested'#000+
   '11008_F_Too many config files nested'#000+
   '11009_F_Unable to open file $1'#000+
   '11009_F_Unable to open file $1'#000+
-  '11010_N_Reading further options from $1'#000+
+  '11010_D_Reading further options from $1'#000+
   '11011_W_Target is already set to: $1'#000+
   '11011_W_Target is already set to: $1'#000+
   '11012_W_Shared libs not ','supported on DOS platform, reverting to stat'+
   '11012_W_Shared libs not ','supported on DOS platform, reverting to stat'+
   'ic'#000+
   'ic'#000+

+ 13 - 28
compiler/options.pas

@@ -1,4 +1,3 @@
-
 {
 {
     $Id$
     $Id$
     Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
     Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
@@ -89,7 +88,6 @@ var
   asm_is_set  : boolean; { -T also change initoutputformat if not set idrectly }
   asm_is_set  : boolean; { -T also change initoutputformat if not set idrectly }
   fpcdir,
   fpcdir,
   ppccfg,
   ppccfg,
-  msgfilename,
   param_file    : string;   { file to compile specified on the commandline }
   param_file    : string;   { file to compile specified on the commandline }
 
 
 {****************************************************************************
 {****************************************************************************
@@ -118,17 +116,6 @@ begin
 end;
 end;
 
 
 
 
-procedure MaybeLoadMessageFile;
-begin
-{ Load new message file }
-  if (msgfilename<>'')  then
-    begin
-       LoadMsgFile(msgfilename);
-       msgfilename:='';
-    end;
-end;
-
-
 procedure set_default_link_type;
 procedure set_default_link_type;
 begin
 begin
   if (target_os.id=os_i386_win32) then
   if (target_os.id=os_i386_win32) then
@@ -181,7 +168,6 @@ procedure Toption.WriteInfo;
 var
 var
   p : pchar;
   p : pchar;
 begin
 begin
-  MaybeLoadMessageFile;
   p:=MessagePchar(option_info);
   p:=MessagePchar(option_info);
   while assigned(p) do
   while assigned(p) do
    Comment(V_Normal,GetMsgLine(p));
    Comment(V_Normal,GetMsgLine(p));
@@ -209,7 +195,6 @@ var
   s     : string;
   s     : string;
   p     : pchar;
   p     : pchar;
 begin
 begin
-  MaybeLoadMessageFile;
   WriteLogo;
   WriteLogo;
   Lines:=4;
   Lines:=4;
   Message1(option_usage,system.paramstr(0));
   Message1(option_usage,system.paramstr(0));
@@ -1018,7 +1003,7 @@ begin
          end
          end
         else
         else
          begin
          begin
-           if (opts[1]='-') then
+           if (opts[1]='-') or (opts[1]='@') then
             begin
             begin
               if (not skip[level]) then
               if (not skip[level]) then
                 interpret_option(opts,false);
                 interpret_option(opts,false);
@@ -1104,17 +1089,17 @@ begin
      opts:=system.paramstr(paramindex);
      opts:=system.paramstr(paramindex);
      case opts[1] of
      case opts[1] of
        '@' :
        '@' :
+         if not firstpass then
          begin
          begin
            Delete(opts,1,1);
            Delete(opts,1,1);
-           if not firstpass then
-            Message1(option_reading_further_from,opts);
+           Message1(option_reading_further_from,opts);
            interpret_file(opts);
            interpret_file(opts);
          end;
          end;
        '!' :
        '!' :
+         if not firstpass then
          begin
          begin
            Delete(opts,1,1);
            Delete(opts,1,1);
-           if not firstpass then
-            Message1(option_reading_further_from,'(env) '+opts);
+           Message1(option_reading_further_from,'(env) '+opts);
            interpret_envvar(opts);
            interpret_envvar(opts);
          end;
          end;
        else
        else
@@ -1140,17 +1125,17 @@ begin
      Delete(cmd,1,i);
      Delete(cmd,1,i);
      case opts[1] of
      case opts[1] of
        '@' :
        '@' :
+         if not firstpass then
          begin
          begin
            Delete(opts,1,1);
            Delete(opts,1,1);
-           if not firstpass then
-            Message1(option_reading_further_from,opts);
+           Message1(option_reading_further_from,opts);
            interpret_file(opts);
            interpret_file(opts);
          end;
          end;
        '!' :
        '!' :
+         if not firstpass then
          begin
          begin
            Delete(opts,1,1);
            Delete(opts,1,1);
-           if not firstpass then
-            Message1(option_reading_further_from,'(env) '+opts);
+           Message1(option_reading_further_from,'(env) '+opts);
            interpret_envvar(opts);
            interpret_envvar(opts);
          end;
          end;
        '"' :
        '"' :
@@ -1450,9 +1435,6 @@ begin
       end;
       end;
   end;
   end;
 
 
-{ Reload the messages file if necessary }
-  MaybeLoadMessageFile;
-
 { write logo if set }
 { write logo if set }
   if option.DoWriteLogo then
   if option.DoWriteLogo then
    option.WriteLogo;
    option.WriteLogo;
@@ -1572,7 +1554,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  2001-03-10 13:19:10  peter
+  Revision 1.36  2001-03-13 20:59:56  peter
+    * message loading fixes from Sergey (merged)
+
+  Revision 1.35  2001/03/10 13:19:10  peter
     * don't check messagefile for numbers, this allows the usage of
     * don't check messagefile for numbers, this allows the usage of
       1.1 msgfiles with a 1.0.x compiler
       1.1 msgfiles with a 1.0.x compiler
 
 

+ 27 - 3
compiler/verbose.pas

@@ -67,11 +67,12 @@ Const
 var
 var
   msg : pmessage;
   msg : pmessage;
 
 
+const
+  msgfilename : string = '';
+
 procedure SetRedirectFile(const fn:string);
 procedure SetRedirectFile(const fn:string);
 function  SetVerbosity(const s:string):boolean;
 function  SetVerbosity(const s:string):boolean;
 
 
-procedure LoadMsgFile(const fn:string);
-
 procedure SetCompileModule(p:tmodulebase);
 procedure SetCompileModule(p:tmodulebase);
 procedure Stop;
 procedure Stop;
 procedure ShowStatus;
 procedure ShowStatus;
@@ -289,6 +290,17 @@ var
       end;
       end;
 
 
 
 
+    procedure MaybeLoadMessageFile;
+      begin
+        { Load new message file }
+        if (msgfilename<>'')  then
+         begin
+           LoadMsgFile(msgfilename);
+           msgfilename:='';
+         end;
+      end;
+
+
     procedure SetCompileModule(p:tmodulebase);
     procedure SetCompileModule(p:tmodulebase);
       begin
       begin
         current_module:=p;
         current_module:=p;
@@ -523,30 +535,35 @@ var
 
 
     function  MessagePchar(w:longint):pchar;
     function  MessagePchar(w:longint):pchar;
       begin
       begin
+        MaybeLoadMessageFile;
         MessagePchar:=msg^.GetPchar(w)
         MessagePchar:=msg^.GetPchar(w)
       end;
       end;
 
 
 
 
     procedure Message(w:longint);
     procedure Message(w:longint);
       begin
       begin
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get(w));
         Msg2Comment(msg^.Get(w));
       end;
       end;
 
 
 
 
     procedure Message1(w:longint;const s1:string);
     procedure Message1(w:longint;const s1:string);
       begin
       begin
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get1(w,s1));
         Msg2Comment(msg^.Get1(w,s1));
       end;
       end;
 
 
 
 
     procedure Message2(w:longint;const s1,s2:string);
     procedure Message2(w:longint;const s1,s2:string);
       begin
       begin
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get2(w,s1,s2));
         Msg2Comment(msg^.Get2(w,s1,s2));
       end;
       end;
 
 
 
 
     procedure Message3(w:longint;const s1,s2,s3:string);
     procedure Message3(w:longint;const s1,s2,s3:string);
       begin
       begin
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get3(w,s1,s2,s3));
         Msg2Comment(msg^.Get3(w,s1,s2,s3));
       end;
       end;
 
 
@@ -557,6 +574,7 @@ var
       begin
       begin
         oldpos:=aktfilepos;
         oldpos:=aktfilepos;
         aktfilepos:=pos;
         aktfilepos:=pos;
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get(w));
         Msg2Comment(msg^.Get(w));
         aktfilepos:=oldpos;
         aktfilepos:=oldpos;
       end;
       end;
@@ -568,6 +586,7 @@ var
       begin
       begin
         oldpos:=aktfilepos;
         oldpos:=aktfilepos;
         aktfilepos:=pos;
         aktfilepos:=pos;
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get1(w,s1));
         Msg2Comment(msg^.Get1(w,s1));
         aktfilepos:=oldpos;
         aktfilepos:=oldpos;
       end;
       end;
@@ -579,6 +598,7 @@ var
       begin
       begin
         oldpos:=aktfilepos;
         oldpos:=aktfilepos;
         aktfilepos:=pos;
         aktfilepos:=pos;
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get2(w,s1,s2));
         Msg2Comment(msg^.Get2(w,s1,s2));
         aktfilepos:=oldpos;
         aktfilepos:=oldpos;
       end;
       end;
@@ -590,6 +610,7 @@ var
       begin
       begin
         oldpos:=aktfilepos;
         oldpos:=aktfilepos;
         aktfilepos:=pos;
         aktfilepos:=pos;
+        MaybeLoadMessageFile;
         Msg2Comment(msg^.Get3(w,s1,s2,s3));
         Msg2Comment(msg^.Get3(w,s1,s2,s3));
         aktfilepos:=oldpos;
         aktfilepos:=oldpos;
       end;
       end;
@@ -630,7 +651,10 @@ var
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2000-12-26 15:58:29  peter
+  Revision 1.12  2001-03-13 20:59:56  peter
+    * message loading fixes from Sergey (merged)
+
+  Revision 1.11  2000/12/26 15:58:29  peter
     * check for verbosity in verbose instead of comphook
     * check for verbosity in verbose instead of comphook
 
 
   Revision 1.10  2000/12/25 00:07:30  peter
   Revision 1.10  2000/12/25 00:07:30  peter