comp.lang.ada
 help / color / mirror / Atom feed
From: Austin Obyrne <austin.obyrne@hotmail.com>
Subject: Re: Will Ada-95 Programs Written in MS Windows Run in MacOS and Linux Without Some Tweaking.
Date: Sun, 8 Dec 2013 10:44:00 -0800 (PST)
Date: 2013-12-08T10:44:00-08:00	[thread overview]
Message-ID: <6d347aed-dce2-4b55-9e35-603f18f06fcb@googlegroups.com> (raw)
In-Reply-To: <lywqjf45za.fsf@pushface.org>

On Sunday, December 8, 2013 5:17:45 PM UTC, Simon Wright wrote:
> Austin Obyrne <austin.obyrne@hotmail.com> writes: > Could I ask you to start again and download "SureCrypt Cipher" from > > http://www.adacryptpages.com Things are not as good as I'd hoped. The programs build OK (aside from a warning or two), but general_decryption_program_mark_1 fails immediately with Execution terminated by unhandled exception Exception name: STORAGE_ERROR Message: stack overflow at the start of the main program. This is usually a symptom of not having enough stack space, caused (in your case) by having lots of large arrays in the main program, not helped by initialising them - there was a recent thread[1] here about this. On the Mac there's a default stack limit of 8Mb; other OS's will have different limits, if limits at all. After poking at this for some time, there are two solutions: (a) move all the array declarations to a package of their own (for example, General_Decryption_Program_Mark_1_Arrays) and with/use it. The arrays are no longer on the stack (I'm not sure about the initializers). (b) increase the program's stack size. The help for gnatbind says I could add the switch -d16m for a 16 Mb stack, but this had no effect; instead, there's a Mac-specific way of doing this which I won't bore you with. Having got the program to start, I tried to decrypt the supplied CipherTextFile_1.dat and got Execution terminated by unhandled exception Exception name: ADA.IO_EXCEPTIONS.DATA_ERROR and as far as I can tell this was caused by the Windows line terminator[2] in the data file; that's to say, when I removed the CR character from the Windows CR/LF the program decoded correctly. I'm not sure of the best way to get an Ada program not to care what sort of input line terminators it's reading. --S [1] https://groups.google.com/forum/?hl=en#!searchin/comp.lang.ada/large$20array%7Csort:date/comp.lang.ada/d-HSSQR9jHo/NjNp6cl6WaIJ [2] http://en.wikipedia.org/wiki/Newline

Hi Simon,

I think part of the trouble may be caused by one very large counting array that is not really necessary to the running of the program in the program as follows,

Could I ask you to comment out all of this counting function and try again.

GENERAL_DECRYPTION_PROGRAM_MARK_1.adb

This is the array in question – note I have commented it out later.

SUBTYPE Index_34 IS Integer RANGE -1000000 .. 1000000;
TYPE I_CoefficientsNumArray IS ARRAY(Index_34) OF Integer;
I_Num : I_CoefficientsNumArray:= (others =>0);
  -- counts the nominated coefficients of the ciphertext.
 
*Could I ask you to totally disable this counting function by commenting out these lines of source code as follows.
 
Line 32      --    Q    : Integer;

Lines 238, 239, 240. 241 

--  SUBTYPE Index_34 IS Integer RANGE -1000000 .. 1000000;
--  TYPE I_CoefficientsNumArray IS ARRAY(Index_34) OF Integer;
--  I_Num : I_CoefficientsNumArray:= (others =>0);
--  -- counts the nominated coefficients of the ciphertext.

Lines 881, 882,

--  Q:= W(1)REM 1000000;
--  I_Num(Q) := I_Num(Q)+1;

Pleases see next,

BATCH_ENCRYPTION_PROGRAM_MARK_1.adb

The corresponding lines to be commented out in the encryption program are,

Line 32: --    Q    : Integer;

Lines 251,252,253,254

--  SUBTYPE Index_36 IS Integer RANGE -1000000 .. 1000000;
--  TYPE I_CoefficientsNumArray IS ARRAY(Index_36) OF Integer;
--  I_Num : I_CoefficientsNumArray:= (others =>0);
--  -- counts the nominated coefficients of the ciphertext.

Lines 972,973

--  Q:= W(1)REM 1000000;
--  I_Num(Q) := I_Num(Q)+1;
 
Finally, 

EMAIL_ENCRYPTIONS_MARK_1.adb

The lines for commenting out here are,

Line 33: --    Q    : Integer;
253,254,255,256,

--  SUBTYPE Index_36 IS Integer RANGE -1000000 .. 1000000;
--  TYPE I_CoefficientsNumArray IS ARRAY(Index_36) OF Integer;
--  I_Num : I_CoefficientsNumArray:= (others =>0);
--  -- counts the nominated coefficients of the ciphertext.

Lines 940,941,

--  Q:= W(1)REM 1000000;
--  I_Num(Q) := I_Num(Q)+1;

• I have test run the programs after this commenting out exercise and they run ok.

Thanks for going to this extreme trouble.

I think the line problem requires an exception handler related to the GET function.(fools ruch in....)

Austin.


  parent reply	other threads:[~2013-12-08 18:44 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-07 12:24 Will Ada-95 Programs Written in MS Windows Run in MacOS and Linux Without Some Tweaking Austin Obyrne
2013-12-07 13:16 ` Simon Wright
2013-12-07 14:01   ` Austin Obyrne
2013-12-07 17:18     ` Simon Wright
2013-12-07 18:26       ` Austin Obyrne
2013-12-08 17:17         ` Simon Wright
2013-12-08 18:17           ` Jeffrey Carter
2013-12-08 20:00             ` Simon Wright
2013-12-08 21:20               ` Jeffrey Carter
2013-12-08 18:44           ` Austin Obyrne [this message]
2013-12-08 20:10             ` Simon Wright
2013-12-08 20:31               ` Austin Obyrne
2013-12-08 22:39               ` Austin Obyrne
2013-12-16 11:46                 ` Simon Wright
2013-12-16 19:00                   ` Austin Obyrne
2013-12-16 21:19                     ` Simon Wright
2013-12-16 21:40                       ` Austin Obyrne
2013-12-18  4:44                       ` Austin Obyrne
2013-12-18  8:35                         ` Simon Wright
2013-12-18  9:54                           ` Austin Obyrne
2013-12-18  4:57                       ` Austin Obyrne
2013-12-18  8:55                         ` Simon Wright
2013-12-18  5:38                       ` Austin Obyrne
2013-12-18  9:02                         ` Simon Wright
2013-12-18 13:02                           ` Austin Obyrne
2013-12-16 19:24                   ` Austin Obyrne
2013-12-17  9:06                   ` Austin Obyrne
2013-12-08 20:01           ` Simon Wright
2013-12-10  6:37           ` Randy Brukardt
2013-12-10 10:14             ` Austin Obyrne
2013-12-10 11:39             ` Austin Obyrne
2013-12-10 21:49               ` Randy Brukardt
2013-12-10 23:08                 ` Binary versus text and compiler versions, was: " Simon Clubley
2013-12-11  8:35                   ` Dmitry A. Kazakov
2013-12-11 12:50                     ` Simon Clubley
2013-12-11 13:29                       ` Dmitry A. Kazakov
2013-12-11 14:20                         ` Simon Wright
2013-12-11 18:25                           ` Simon Clubley
2013-12-11 14:53                     ` G.B.
2013-12-11 15:14                       ` Eryndlia Mavourneen
2013-12-11 16:07                         ` Austin Obyrne
2013-12-11 16:26                           ` Eryndlia Mavourneen
2013-12-11 17:37                             ` Austin Obyrne
2013-12-11 17:54                               ` Eryndlia Mavourneen
2013-12-12  1:55                                 ` Austin Obyrne
2013-12-11 16:54                         ` G.B.
2013-12-11 11:37                   ` Austin Obyrne
2013-12-12 19:23                     ` erlo
2013-12-11 10:35                 ` Austin Obyrne
2013-12-11  0:34             ` Simon Wright
2013-12-11  1:01               ` Jeffrey Carter
2013-12-11  8:38                 ` Simon Wright
2013-12-11 17:07                   ` Simon Wright
2013-12-11  8:49               ` Simon Wright
2013-12-07 22:49       ` Austin Obyrne
2013-12-07 14:08   ` Austin Obyrne
2013-12-08 20:06 ` Stephen Leake
replies disabled

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