Method for input and output of structures for the Java language
AssigneeCompaq Computers Corporation
InventorAlan L. Gerhardt
Life of this patent
Estimating the term…
Abstract
The present invention includes a method and apparatus that allows languages to send, receive and manipulate structures defined by other languages. Structurally, the present invention includes a preprocessor and a runtime library. The preprocessor accepts, as input, source code written in a high-level language, such as C or C++. The preprocessor produces, as output, a series of Java classes. Each Java class describes a structure defined in the input source code. Java programs use the descriptions produced by the preprocessor to send, receive and manipulate structures the structures defined in the input source code.
Claims19
A method for using a structure defined by using a first programming language in a program defined by using a second programming language, the method including the steps, performed by a computer system, of:
- receiving a semantic construct that corresponds to a structure definition in the first programming language, the structure definition having a number of elements;
- defining a class corresponding to the structure definition using the second programming language;
- and
- defining one or more class members in the class, each class member corresponding to a respective element included in the structure definition, each class member initialized to be a value equal to the byte offset of the corresponding element in the structure definition.
A preprocessor for receiving programs and structures defined by using a first programming language and producing classes defined using a second programming language, the preprocessor performing the steps of:
- receiving semantic constructs and recognizing which semantic constructs correspond with structure definitions defined in the first programming language;
- producing class definitions in the second programming language, each respective class definition corresponding to a recognized structure definition;
- defining class members for each class definitions, wherein each respective class member corresponds with an element included in the structure definition corresponding to the class definition, each class member being initialized to be a value equal to the offset of the corresponding element described by that class member within the structure definition corresponding to that class definition.
A computer program product for receiving programs and structures defined by using a first programming language and producing classes defined using a second programming language, the computer program product comprising:
- a computer-usable medium having computer-readable code embodied therein for performing the steps of:
- recognizing structures defined in the first programming language;
- producing class definitions, each respective class definition corresponding to a recognized structure;
- and
- defining class members for each class definition, each respective class member describing an element included in the structure corresponding to the class definition, with each class member included in any one class definition initialized to be a value equal to the byte offset of the element described by that class member within the structure corresponding to that class definition.
Dependencies are inferred from the claim text.