Method of returning a data structure from a callee function to a caller function for the C programming language
AssigneeTexas Instruments Incorporated
InventorsReid E. Tatge, Alan L. Davis
Life of this patent
Estimating the term…
Abstract
A method of using a computer to execute a computer program, in which a caller portion of the program calls a callee function that returns a data structure. Before the callee function is called, the computer is used to determine whether the structure is to be used, and if so, an address to which the structure is to be returned is determined. The caller passes this address to the called function. The callee executes, and if the structure is to be used, the callee copies the structure to the predetermined address.
Claims13
A computer process for specifying an address for returning data in a variable type form of a predetermined structure to a caller function, which declares the returned data in the form of the predetermined structure rather than passes it as an argument, from a callee function, comprising the steps of:
- for a call from said caller function to said callee function, determining whether said callee function will return data in the form of the predetermined structure to said caller function;
- if said callee function will return data in the form of the predetermined structure, interpreting said caller function to determine whether other data in the form of the predetermined structure already has an address in memory and whether said caller function will use said returned data in the form of the predetermined structure;
- if other data in the form of the predetermined structure already has an address in memory, generating a data return address corresponding to said address already in memory;
- if other data in the form of the predetermined structure does not already have an address in memory, generating a data return address for said returned data as a new address;
- if said caller function will not use said returned data, generating a data return address for said returned data as an invalid address;
- commencing execution of said caller function;
- passing said data return address to said callee function upon occurrence of the call from said caller function to said callee function;
- and
- transferring control to said callee function upon occurrence of the call from said caller function to said callee function.
A computer process for returning data in a variable type form of a predetermined structure to a caller function, which declares the returned data in the form of the predetermined structure rather than passes it as an argument, from a callee function, comprising the steps of:
- for a call from said caller function to said callee function, determining whether said callee function will return data in the form of the predetermined structure to said caller function;
- if said callee function will return data in the form of the predetermined structure, interpreting said caller function to determine whether other data in the form of the predetermined structure already has an address in memory and whether said caller function will use said returned data in the form of the predetermined structure;
- if other data in the form of the predetermined structure already has an address in memory, generating a data return address corresponding to said address already in memory;
- if other data in the form of the predetermined structure does not already have an address in memory, generating a data return address for said returned data as a new address;
- if said caller function will not use said returned data, generating a data return address for said returned data as an invalid address;
- commencing execution of said caller function;
- passing said data return address to said callee function upon occurrence of the call from said caller function to said callee function;
- transferring control to said callee function upon occurrence of the call from said caller function to said callee function;
- executing said callee function to generate returned data in the form of the predetermined structure;
- determining whether said data return address is a valid address;
- if said data return address is valid, copying said returned data in the form of the predetermined structure to said data return address;
- if said data return address is not valid, bypassing said copying step;
- and
- whether said data return address is valid or not, transferring control to said caller function.
Dependencies are inferred from the claim text.