4.1.1 AND 4.1.4
When taking the 'address of an object, if the object's type is an array type (string, array of something, etc.) then you must reference the first byte of the object. This is only necessary if the object has been passed in as a parameter but it is suggested that it be done in all cases as a good programming practice.
EXAMPLE :
Improper My_Object : String (1 .. 10);
Obj_Address : System.Address;
begin
Obj_Address := My_Object'address;
Proper My_Object : String (1 .. 10);
Obj_Address : System.Address;
begin
Obj_Address := My_Object (My_Object'first)'address;
4.1.1 AND 4.1.4
When executing commands such as auglib DO NOT put any extra spaces between the arguments. This will present a problem at link time in the form of an error message showing many undefined symbols, usually from many different packages.
EXAMPLE :
Improper AUGLIB DOSLIB C:\SAGE\DOSLIB.OBJ
Proper AUGLIB DOSLIB C:\SAGE\DOSLIB.OBJ
4.1.1 AND 4.1.4
Assembler code problems that occurred are as follows: a. Cannot use a DUP.
EXAMPLE :
Improper My_Buffer DW 4 DUP (0)
Proper My_Buffer DW (0)
DW (0)
DW (0)
DW (0)
b. Assembler code cannot use a ? for an uninitialized value.
EXAMPLE :
Improper My_Buffer DW ?
Proper My_Buffer DW 0 c. Several of the assembler instructions that created relocation records seemed to cause problems for the linker. d. Apparently assembler code for the 16 bit mode can be assembled with either MASM or Turbo Assembler but 32 bit assembler code must be done with MASM. NOTE: The problems listed above occured only with the Bamp linker, not when another linker was used. Please see the Meridian Ada manual, pragma Interface section.
If the target type of an Unchecked_Conversion is a pointer to an array type then the array type must have static indices.
EXAMPLE :
Improper - type Nat_access is
access ModSys.Natural_U_Array (Var1 .. Var2);
function Address_To_NaturalAccess is
new Unchecked_Conversion (System.Address,
Nat_access);
Also Improper - type Nat_access is
access ModSys.Natural_U_Array (Natural(1) ..
Natural (1000));
function Address_To_NaturalAccess is
new Unchecked_Conversion (System.Address,
Nat_access);
Proper - type Nat_access is
access ModSys.Natural_U_Array (1 .. 1000);
function Address_To_NaturalAccess is
new Unchecked_Conversion (System.Address,
Nat_access);
4.1.1 AND 4.1.4
When compiling a unit into the local library which is also present in a library to which this library has a link, you are required to compile both a spec and a body. Doing this in Sage-ST TM will then make some of the Sage-ST TM bodies obsolete and would require them to be recompiled.
Since you would be incapable of doing this you would be stuck.
IMPACT :
This impacts the use of the CheckLib, FormChk and HelpLib packages in Sage-ST TM . If you are using an Sage-ST TM library in one location and a local library with links back to it then you must compile the CheckLib, FormChk and HelpLib packages into the Sage-ST TM library. If you are using the Sage-ST TM library in the local directory as the development library then you can compile directly into it. Doing this would require only a body for these packages to be compiled.
4.1.1 AND 4.1.4
In order to get exception error messages printed out at runtime you have to do it within Text_Io.
4.1.1 AND 4.1.4
On the other platforms to which Sage-ST TM has been ported there are both 32 and 64 bit floating point types. On this platform both the Float and Long_Float types are 64 bit.
ANSWER - There is a 32 bit float type available but it is not documented. If an object is declared to be of type short_float and then the fl flag is used, that object will be 32 bits.
4.1.1 AND 4.1.4
Assembler code cannot be debugged using the provided debugger because there is no low level debug capability.
4.1.1 AND 4.1.4
Package initialization code cannot be debugged using the provided debugger. In the example the line which reads 'Var1 := 10;' will be executed before the first line of the main program. There is no way to set breakpoints on this line before it occurs.
EXAMPLE :
package body My_Package is
Var1 : Integer;
procedure Proc1 is
begin
null;
end Proc1;
begin
Var1 := 10;
end My_Package
;
4.1.1
An array was inadvertently declared which went over 64K, no error at compile or link time. At runtime it locked the machine.
4.1.1 AND 4.1.4
We tried to do a bamp g r [filename]. When the optimization finished it dropped to a DOS prompt without producing an OBJ file.
ANSWER - Meridian Technical Support pointed out that the solution to this problem is documented in the Meridian Release Notes. If you wish to use the optimization option, bamp G or g, with the r option, you will also need to use the bamp o option to specify an alternate object file (different from any of the object modules used by your programs) as in this example:
bamp g r o simple2 simple
4.1.1 AND 4.1.4
In order to debug any package both the spec and body must be recompiled with the fD flag. Recompiling the spec then causes any packages 'with'ing this one to be recompiled. Depending on the need this can cause a massive recompilation. After doing the debugging and fixing any problems the same code must be recompiled without the flag in order to get rid of the debugging code.
4.1.1 AND 4.1.4
Be careful of Unchecked_Conversions from an address to a pointer to an array. The array type MUST be constrained. If the array type is unconstrained then the pointer will have undefined indices.
EXAMPLE :
Improper -
with System;
with Unchecked_Conversion;
procedure Test is
type Record_Type is record
Index : Natural;
Height : Natural;
width : Natural;
Descender : Natural;
end record;
type Record_Array_Type is array (Natural range <>) of Record_Type;
type Record_Array_Access is access Record_Array_Type;
Rec_Access : Record_Array_Access;
function Address_To_Rec_Access is
new Unchecked_Conversion (System.address, Record_Array_Access);
procedure Test_Conversion
(Record_Address : in System.address) is
Local_Record_Access : Record_Array_Access;
begin
Local_Record_Access := Address_To_Rec_Access (Record_Address);
-- |
-- | This pointer is now pointing to an array with an undefined
-- | range on the indices.
-- |
end Test_Conversion;
begin
Rec_Access := new Record_Array_Type(0 .. 255);
Test_Conversion (Record_Address =>
Rec_Access(Rec_Access.all'first)'address);
end Test;
Proper -
with System;
with Unchecked_Conversion;
procedure Test is
type Record_Type is record
Index : Natural;
Height : Natural;
width : Natural;
Descender : Natural;
end record;
type Record_Array_Type is array
(Natural range 0 .. 255) of Record_Type;
type Record_Array_Access is access Record_Array_Type;
Rec_Access : Record_Array_Access;
function Address_To_Rec_Access is
new Unchecked_Conversion (System.address, Record_Array_Access);
procedure Test_Conversion
(Record_Address : in System.address) is
Local_Record_Access : Record_Array_Access;
begin
Local_Record_Access := Address_To_Rec_Access (Record_Address);
-- |
-- | This pointer is now pointing to an array with a 0 .. 255
-- | range on the indices.
-- |
end Test_Conversion;
begin
Rec_Access := new Record_Array_Type;
Test_Conversion (Record_Address =>
Rec_Access(Rec_Access.all'first)'address);
end Test;
Go Back to
Sage-ST
TM
TABLE OF CONTENTS
warren.merrill@inl.gov
,
ftp://sage.inel.gov
Copyright © 1989-2006. Battelle Energy Alliance