comp.lang.ada
 help / color / mirror / Atom feed
From: "Adaddict" <adaddict@hotmail.com>
Subject: (Follow-up)
Date: Sun, 07 Aug 2005 12:15:32 -0400
Date: 2005-08-07T12:15:32-04:00	[thread overview]
Message-ID: <4b599f2a499d4157d3904e163be90ad5@localhost.talkaboutprogramming.com> (raw)
In-Reply-To: 2db7e95053c018032e212a9f7c2c614d@localhost.talkaboutprogramming.com

Thank you for the replies. I'm using Windows XP SP2, GNAT 3.15p and Ada
GIDE. The aplication has to work on Win XP.

The function that causes this error is called from the main task, but the
big variable is local from that function. I'll write a simple version of
the function:

procedure Search_str (FileAccess : in Handle; Query : in string; 
                      Results : out Integer) is
  mbi     : Memory_Basic_Information;
  lpPos   : uinteger;
  lPos    : integer;
  CalcPos : uinteger;
  max     : uinteger;
  length  : constant integer := Query'last;
  
begin
  Results := 0;  
  lpPos := Min_Pos; max := Max_Pos;
  
  while lpPos < max loop
    mbi.RegionSize := 0;
    mbi := Query_Pos (FileAccess, lpPos); 
    if ((mbi.C_Type = PRIVATE_DATA) and (mbi.State = COMMIT_DATA)) then
      if mbi.RegionSize > 0 then
        declare
          sBuffer : string (1..integer(mbi.RegionSize));
        begin
          sBuffer := Read(FileAccess, mbi.BasePos, mbi.RegionSize);
          lPos := instr (Query, length, sBuffer); 
          if lpos > 0 then
            CalcAddress := address_to_uinteger(mbi.BaseAddress) +
uinteger(lPos);
            Put_Line ("Search string was found at position" &
uInteger'image(CalcPos) & "."); Results := Results+1;
          end if;
        end;
      end if;
    end if;
    lpPos := mbi.BasePos + mbi.RegionSize;
  end loop;
end Search_str;

Thankyou everyone again.

Kind regards.




  parent reply	other threads:[~2005-08-07 16:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-05  0:55 STORAGE_ERROR : EXCEPTION_STACK_OVERFLOW Adaddict
2005-08-05  1:21 ` Adaddict
2005-08-06 11:21 ` How to set the stack size on GNAT (Follow-up) Adaddict
2005-08-07 12:33   ` Please, help me Adaddict
2005-08-07 14:11     ` Jeff Creem
2005-08-07 14:51       ` Increasing stack size (was: Please, help me.) Larry Kilgallen
2005-08-07 15:16       ` Please, help me Ludovic Brenta
2005-08-07 15:31   ` How to set the stack size on GNAT (Follow-up) John B. Matthews
2005-08-07 16:15   ` Adaddict [this message]
2005-08-07 17:59     ` (Follow-up) Jeffrey Carter
2005-08-07 20:49       ` (Follow-up) Adaddict
2005-08-09 22:05 ` Follow up 2: raised STORAGE_ERROR : helper.adb:386 object too large Adaddict
2005-08-10  4:56   ` Jeff Creem
2005-08-10 17:44     ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox