[Lazarus] Groudwork for Undo in Form Designer

dmitry boyarintsev skalogryz.lists at gmail.com
Sat Jan 9 05:38:01 CET 2010


On Sat, Jan 9, 2010 at 12:20 AM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> At least the error message could mention the actual number of entries, as
> found in source code. This doesn't require any change to the language or
> compiler, only an change to the error message generation.

lol, something like this?! :) sorry, my vds is down can't publish the
whole patch...

Index: ptconst.pas
===================================================================
--- ptconst.pas	(revision 14581)
+++ ptconst.pas	(working copy)
@@ -843,14 +843,25 @@
           else if try_to_consume(_LKLAMMER) then
             begin
               hr.offset:=0;
-              for i:=def.lowrange to def.highrange-1 do
-                begin
-                  read_typed_const_data(hr,def.elementdef);
-                  Inc(hr.offset,def.elementdef.size);
-                  consume(_COMMA);
-                end;
-              read_typed_const_data(hr,def.elementdef);
-              consume(_RKLAMMER);
+              try
+                //for i:=def.lowrange to def.highrange-1 do
+                i:=def.lowrange;
+                while i<def.highrange do
+                  begin
+                    read_typed_const_data(hr,def.elementdef);
+                    Inc(hr.offset,def.elementdef.size);
+                    consume(_COMMA);
+                    inc(i);
+                  end;
+              except
+                Message2( scan_f_not_enough_const_array_elements,
intToStr(i), IntToStr(def.highrange-def.lowrange+1));
+              end;
+              read_typed_const_data(hr,def.elementdef);
+              try
+                consume(_RKLAMMER);
+              except
+                Message1( scan_f_too_many_const_array_elements,
IntToStr(def.highrange-def.lowrange+1));
+              end;
             end
           { if array of char then we allow also a string }
           else if is_char(def.elementdef) then
Index: msg/errore.msg
===================================================================
--- msg/errore.msg	(revision 14581)
+++ msg/errore.msg	(working copy)
@@ -362,6 +362,10 @@
 scan_w_multiple_main_name_overrides=02086_W_Overriding name of "main"
procedure multiple times, was previously set to "$1"
 % The name for the main entry procedure is specified more than once.
Only the last
 % name will be used.
+scan_f_not_enough_const_array_elements=02087_F_Not enough elements in
constant array. Only $1 of $2 are delcared
+% Only part of array of constant is declared
+scan_f_too_many_const_array_elements=02088_F_Too many constant array
elements. Only $1 required
+% Only part of array of constant is declared
 % \end{description}




More information about the Lazarus mailing list