Automatic conversion of units in a computer program
AssigneeInternational Business Machines Corporation
InventorRajendra Kumar Bera
Life of this patent
Estimating the term…
Abstract
A remedial method (200) and apparatus (100) is described, by which unit information can be documented in a computer program. A set of user-supplied precompiler directives is added to the computer program that is to be converted, in which a preferred set of units, called primary units, are prescribed. A precompiler tool performs a conversion of a unit to its corresponding unit in the preferred set of units.
Claims13
A method of converting units in a computer program, said method comprising the steps of:
- (a1) accepting as input a unit identifier for each variable used in said computer program, wherein each unit identifier comprises one or more unit elements;
- (a2) accepting as input a primary unit element from each group of unit elements;
- (a3) accepting as input a relation between each of said unit elements and one of said groups of unit elements and a conversion factor to said primary unit element of said group of unit elements;
- (d) identifying instances of said variables in said computer program;
- (e) augmenting said instances of said variables with a corresponding one of said unit identifiers;
- and
- (f) identifying, for each unit element, one of said groups of units and replacing said unit element with said primary unit identifier of the respective group, multiplied with said conversion factor.
Apparatus for converting units in a computer program, said apparatus comprising:
- input means for:
- accepting as input a unit identifier for each variable used in said computer program, wherein each unit identifier comprises one or more unit elements;
- accepting as input a primary unit element from each group of unit elements;
- and
- accepting as input a relation between each of said unit elements and one of said groups of unit elements and a conversion factor to said primary unit element of said group of unit elements;
- means for identifying instances of said variables in said computer program;
- means for augmenting said instances of said variables with a corresponding one of said unit identifiers;
- and
- means for identifying for each unit element, one of said groups of units and replacing said unit element with said primary unit identifier, multiplied with said conversion factor.
A computer program product, carried on a storage medium, for converting units in a subject computer program, comprising:
- first program means for identifying instances of variables in said subject computer program;
- second program means for augmenting said instances of said variables with a corresponding one of a set of unit identifiers;
- and
- third program means for, for each unit element, identifying one of a groups of units to which it belongs, and replacing said unit element with a respective primary unit identifier multiplied with a respective conversion factor.
A method for converting units in a subject computer program, comprising the steps of:
- identifying instances of variables in said subject computer program;
- augmenting said instances of said variables with a corresponding one of a set of unit identifiers;
- and
- for each unit element, identifying one of a groups of units to which it belongs, and replacing said unit element with a respective primary unit identifier multiplied with a respective conversion factor.
A precompiler for converting units in a subject computer program, comprising:
- means for identifying instances of variables in said subject computer program;
- means for augmenting said instances of said variables with a corresponding one of a set of unit identifiers;
- and
- means for, for each unit element, identifying one of a groups of units to which it belongs, and replacing said unit element with a respective primary unit identifier multiplied with a respective conversion factor.
Dependencies are inferred from the claim text.