Модератор: Модераторы
procedure TIndicator.Draw;
var
  Color: Byte;
  Frame: Char;
  L: array[0..1] of Longint;
  S: String[15];
  B: TDrawBuffer;
  K: String; //[[[[[[[[[[[[[[[[[
begin
  if assigned(CodeOwner) and
     (CodeOwner^.ELockFlag>0) then
    begin
      CodeOwner^.IndicatorDrawCalled:=true;
      exit;
    end;
  if (State and sfDragging = 0) and (State and sfActive <> 0) then
   begin
     Color := GetColor(1);
     Frame := #205;
   end
  else
   begin
     if (State and sfDragging)<>0 then
      Color := GetColor(2)
     else
      Color := GetColor(3);
     Frame := #196;
   end;
  MoveChar(B, Frame, Color, Size.X);
  if State and sfActive<>0 then
   begin
     if Modified then
     WordRec (B[0]).Lo := ord('*');
{$ifdef debug}
     if StoreUndo then
       WordRec (B[1]).Lo := ord('S');
     if SyntaxComplete then
       WordRec(B[2]).lo := ord('C');
     if UseTabs then
       WordRec(B[3]).lo := ord('T');     
{$endif debug}
     L[0] := Location.Y + 1;
     L[1] := Location.X + 1;
   //[[[[[[[[[[[[[[  FormatStr(S, ' %d:%d ', L);  //проблемная процедура
     Str(L[0],S);                  //[[[[[[[[[[[[[[[[[[[[v
     if Length(S)<6 then S:=' '+S;
     S:=S+':';
     Str(L[1],K);
     if Length(K)<3 then K:=K+' ';
     S:=S+K;                       //[[[[[[[[[[[[[[[[[[[[^
     MoveStr(B[8 - Pos(':', S)], S, Color);  
   end;
 WriteBuf(0, 0, Size.X, 1, B);
end;
Сквозняк писал(а):Патч
-  L: array[0..1] of LongInt;
+  L: array[0..1] of Pointer;
...
-  L[0] := Location.Y + 1;
-  L[1] := Location.X + 1;
+  L[0] := Pointer(Location.Y + 1);
+  L[1] := Pointer(Location.X + 1);
...
uses Drivers;
var
  S: string[15];
  L: array [0..1] of Pointer;
begin
  L[0] := Pointer(1025);
  L[1] := Pointer(1026);
  FormatStr(S, ' %d:%d ', L);
  writeln('[', S, ']');
end.
./test32
[ 1025:1026 ]
./test64
[ 1025:1026 ]
procedure FormatStr (Var Result: String; CONST Format: String; Var Params);
TYPE TLongArray = Array[0..0] Of PtrInt;

bormant писал(а):А почему не тривиальное:
alex_alex_alex1 писал(а):По сути осталось самое сложное - исправить отладчик
VAR
Q3,W3: BYTE;
begin
WRITELN('jjkjkj');
W3:=100;
Q3:=1+W3;
WRITELN(Q3);
end.К слову, дело не совсем, а точнее, совсем не в указателях...Сквозняк писал(а):нет привычки а значит и опыта в работе с указателями
{ A generalized string formatting routine. Given a string in Format     }
{ that includes format specifiers and a list of parameters in Params,   }
{ FormatStr produces a formatted output string in Result.               }
{ Format specifiers are of the form %[-][nnn]X, where                   }
{   % indicates the beginning of a format specifier                     }
{  [-] is an optional minus sign (-) indicating the parameter is to be  }
{      left-justified (by default, parameters are right-justified)      }
{ [nnn] is an optional, decimal-number width specifier in the range     }
{      0..255 (0 indicates no width specified, and non-zero means to    }
{      display in a field of nnn characters)                            }
{   X  is a format character:                                           }
{   's' means the parameter is a pointer to a string.                   }
{   'd' means the parameter is a Longint to be displayed in decimal.    }
{   'c' means the low byte of the parameter is a character.             }
{   'x' means the parameter is a Longint to be displayed in hexadecimal.}
{   '#' sets the parameter index to nnn.                                }
procedure FormatStr (Var Result: String; CONST Format: String; Var Params);
type
  TLongArray = Array[0..0] Of PtrInt;
...
           Case Format[FormatIndex] Of
...
           'c': S := Char(TLongArray(Params)[I]);          { Character parameter }
           'd': S := LongToStr(TLongArray(Params)[I],10);  { Decimal parameter }
           's': S := PString(TLongArray(Params)[I])^;      { String parameter }
           'x': S := LongToStr(TLongArray(Params)[I],16);  { Hex parameter }
           end;
...

alex_alex_alex1 писал(а):Надо брать gdb последних версий. Для Магея 2 это gdb-7.3.50, для Магея 3 это gdb-7.5.1.

alex_alex_alex1 писал(а):Собрать с gdb не проблема
alex_alex_alex1 писал(а):libgdb.a появляется при сборке gdb всё равно, но в пакеты не попадает. Откуда взять? Пересобрать gdb.

Вернуться в Разработки на нашем сайте
Сейчас этот форум просматривают: Yandex [Bot] и гости: 1