home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / menu / mmgrtr.doc < prev   
Encoding:
Text File  |  1988-05-03  |  7.6 KB  |  217 lines

  1.  
  2.  
  3.  
  4.  
  5.                           FINAL REPORT
  6.  
  7.                 VIDEO MENU-MANAGER SOFTWARE SYSTEM
  8.                     CONVERSION TO Ada LANGUAGE
  9.                 ISSUES OF CONVERSION AND REHOSTING
  10.  
  11.  
  12.                   Contract No. N66001-85-C-0049
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                     May 17, 1985
  23.  
  24.  
  25.                     Submitted to
  26.  
  27.                 Naval Ocean Systems Center
  28.                    San Diego, CA 92152
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.                     AdaSoft, Inc.
  42.                      9300 Annapolis Road
  43.                       Lanham, MD  20706
  44. INTRODUCTION 
  45.  
  46.   The following is a summation of the problems encountered in converting the
  47. original Fortran code to Ada code, using the Telesoft-Ada compiler V 1.5, and
  48. rehosting the software from the IBM-PC/XT version to the VAX/VMS version. These
  49. problems have been previously reported in the monthly status reports filed in
  50. accordance with the requirements of the contract (CDRL item A004 ).
  51.  
  52. CONVERTING FORTRAN CODE TO Ada
  53.  
  54. There were no problems encountered in conversion of the sortware from existing
  55. Fortran code to Ada code. This is primarily due to the fact that conceptual
  56. coversion was performed rather than a line-by-line conversion. It is our
  57. conclusion that conceptual conversion will result in better Ada code which is
  58. more in keeping with the design philosophies associated with the Ada language.
  59.  
  60. USING THE TELESOFT-Ada COMPILER V 1.5
  61.  
  62. Unimplemented features of the Ada language were the least significant problem
  63. in the development process. The features we could have used were:
  64.  
  65.   Enumeration_IO: Since we wished to define and use several enumeration types, 
  66. we were forced to accept character input from the user, matching this against a
  67. look-up table. The table was defined as an array of strings, indexed by the
  68. enumeration type we used, and     containing the character representation of the
  69. enumeration type scalar values.
  70.  
  71. Delay Statement: There were several occasions when a delay statement would have
  72. been useful, particularly when several messages were to be output to the same
  73. line.
  74.  
  75. Record/Array Initialization: This was perhaps the most inconvenient
  76. unimplemented feature. It is a particularly useful feature of Ada to be able to
  77. declare a variable of some packed array type, and initialize this with a
  78. statement such as, 1..20=> '*'. The alternative for us was to make all strings
  79. of equal size and use strings of blanks to initialize. Named association for
  80. initializing parts of records was also unimplemented, and required us to
  81. initialize all parts of a record when only certain parts were required to have
  82. an initial value.
  83.  
  84. Undocumented Problems: The Telsoft-Ada compiler V 1.5 has a particular problem
  85. with visibility in library units. This seems to be particularly apparent when
  86. renaming type     declarations defined in another package. For example, 
  87.         
  88.         package A is
  89.             type ENUM_TYPE is ( Q, R, S );
  90.             type POINT_REC is
  91.                 record
  92.                     X : NATURAL;
  93.                     Y : NATURAL;
  94.                 end record;
  95.         end A;
  96.  
  97.         with A;
  98.         package B is 
  99.             subtype ENUM_TYPE is A.ENUM_TYPE;
  100.             subtype POINT_REC is A.POINT_REC;
  101.         end B;
  102.  
  103.         with B;
  104.         package C is
  105.             subtype ENUM_TYPE is B.ENUM_TYPE;
  106.             subtype POINT_REC is B.POINT_REC;
  107.         end C;
  108.  
  109. While tests for membership placed in C will work, any attempt to use a literal
  110. enumeration value in C will be flagged as undeclared. For example, you may not
  111. pass the value Q in place of a parameter, nor can you use Q in an assignment to
  112. a variable of type ENUM_TYPE. In fact, for the values to be available in C, you
  113. must include a "with A, B; use     A, B;" in package C. The use statement "use A;"
  114. must also be included in package B if     references to values of that type are
  115. made in package B.
  116.  
  117. Furthermore, even though POINT_REC is a legitimate subtype of A.POINT_REC, you
  118. may not declare a variable of that type with an initial value without include a
  119. use statement of the package containing the overall type in the package you are
  120. working on. For example, 
  121.         
  122.         POINT : POINT_REC := ( 0,0 );
  123.  
  124. would be unusable in package C unless package A was visible.
  125.  
  126. Qualifying an enumeration literal with it's underlying (base) type will still
  127. be flagged as an error, i.e., 
  128.  
  129.         VAL : ENUM_TYPE := A.ENUM_TYPE'(Q);
  130.  
  131. would be uncompilable, as would any attempt to assign the literal value to the
  132. appropriate type without first using a use statement of the original package,
  133. A. What becomes interesting is that:
  134.  
  135.         TEXT_IO.PUT ( ENUM_TYPE'image(ENUM_TYPE'first));
  136.  
  137. used in package C, without the with statement for A, will compile and will
  138. output the appropriate value.
  139.  
  140. Another problem is that assignment to strings is not correctly implemented. For
  141. example, given the assignments:
  142.  
  143.         S : STRING(1..20);
  144.         T : STRING(1..5);
  145.         U : STRING(1..4);
  146.  
  147. the following statement raises a constraint error:
  148.  
  149.         S := T & U;
  150.  
  151. however, "S(1..T'last + U'last) := T & U;" does work.
  152.  
  153. An additional problem is an apparant inability to resolve overloaded
  154. enumeration values. Given the following code:
  155.  
  156.         package TEST is
  157.             type A is ( BOOT, ROOT, TREE);
  158.             type B is ( BOOT, MENU, PROG);
  159.         end TEST;
  160.  
  161.         with TEST; use TEST;
  162.         package TEST_TOO is 
  163.             procedure ZIP ( I : in A );
  164.         end TEST_TOO;
  165.         package body TEST_TOO is
  166.             procedure ZIP ( I : in A ) is
  167.             begin
  168.                     ***
  169.             end ZIP;
  170.  
  171.             procedure ZIPPO is
  172.             begin
  173.                 ZIP ( BOOT );
  174.             end ZIPPO;
  175.         end TEST_TOO;
  176.  
  177. The compiler could not resolve the overload in the call to ZIP, even though the
  178. parameter list for that routine makes the type clear.
  179.  
  180. When you are using a variant record, the compiler does not check to see if you
  181. are using the correct parts for the discriminant in the code. It will allow you
  182. to declare a variable of the record type, making it have the structure
  183. associated with one case of the discriminant,     and then later assign values to
  184. parts of the record that exist only for another case of the discriminant. This
  185. is not caught until run time. Secondly, if you rename the standard exceptions
  186. and then try to handle them in another package, then unless the package
  187. IO_EXCEPTIONS is visible, you must raise and handle the renamed exceptions,
  188. especially if the rename uses the same name as the original exception.
  189.  
  190. REHOSTING THE VIDEO PACKAGES
  191.  
  192. Several problems were encountered in this area, one of which may be specific to
  193. the NOSC computer. 
  194.  
  195. A problem with forking (calling) a program from inside VIDEO could not be
  196. resolved on the IBM-PC. Apparently the IBM-PC does not have enough stack space
  197. to allow this. The program will run, but never returns to the calling program.
  198. This has not been a problem with the VAX version, however, at this time, the
  199. forking procedure does not allow the forking of a non-Ada program. 
  200.  
  201. The IBM-PC version runs under the ROS operating system. No good
  202. telecommunications programs were found that would allow transfer of files over
  203. the network, nor were attempts at conversion of ROS format text files to DOS
  204. format acceptable. Therefore, we direct-connected to a local VAX, and were then
  205. able to port these files to the VAX, and create a tape in VAX format. We then
  206. loaded the files onto a VAX that had access to the net, and used FTP to pull 
  207. the files to the NOSC system.
  208.  
  209. We had anticipated most of the code-related rehosting problems, and were able
  210. to modify these with little difficulty. We did run into a problem with the
  211. version of Terminal_Control (a proprietary package provide by Telesoft with the
  212. compiler) on the NOSC computer. This  problem had not appeared when we had
  213. previously tested the VIDEO code on a local VAX, and we must assume that the
  214. problem is with the version of this package on the NOSC machine. We were able 
  215. to resolve the problem by writing our own set of procedures to handle the 
  216. terminal control we needed.
  217.