Restructuring computer programs
AssigneeInternational Business Machines Corporation
InventorRajendra Bera
Life of this patent
Estimating the term…
Abstract
A method of restructuring a source computer program to a target computer program. A defined source computer program has source code. A set of tasks is defined for the source computer program to be performed by the source computer program. For each task, a corresponding set of input data sets is defined. For each input data set, a corresponding set of programs is determined such that each program in the set of programs includes declarations and executable statements, from the source code of the source computer program, required to execute the task in each input data set. Each set of programs is processed to generate a component that executes the respective task, resulting in generation of a set of components. A target computer program is generated from the set of components.
Claims29
A method of restructuring a source computer program to a target computer program, the method comprising:
- defining a source computer program P that consists of source code, said source code of the source computer program P comprising a main function F0 and a set of functions {F1, F2, . . . Fr}, wherein F1, F2, . . . Fr are each a function other than the main function F0 and are each adapted return a value to the main function F0 as a result of being executed in response to being called by the main function F0, wherein each function in the set of functions {F1, F2, . . . Fr} is external to the main program F0 and comprises one or more statements and/or declarations, and wherein r is at least 1;
- defining for said source computer program P, a set of tasks T={T1, T2, . . . Tn} able to be performed by said source computer program P, wherein n is at least 1;
- determining, for each task Ti in said set of tasks T, a corresponding set of input data sets Ui={ui1, ui2, . . . uip} for task Ti, wherein p is a function of i denoted asp(i) such that p(i) is at least 1, and wherein each input data set uij in Ui consists of an explicit data value of at least one variable in P;
- and
- determining, for each set of input data sets Ui={ui1, ui2, . . . uip} a corresponding set of programs {ci1, ci2, . . . cip}such that each program cij in the set of programs {ci1, ci2, . . . cip} comprises declarations and executable statements from the source code of P required to execute task Ti for input data set uij in Ui;
- processing each set of programs {ci1, ci2, . . . cip} to generate a component Ci adapted to execute the respective task Ti, said processing resulting in generation of a set of components C={C1, C2, . . . Cn};
- and
- generating a target computer program PR from the set of components C, such that PR comprises a main program H0 and a set of functions H={H1, H2, . . . Hn}.
A method of restructuring a source computer program to a target computer program, the method comprising the steps of:
- defining a source computer program P that consists of source code, said source code of the source computer program P comprising a set of functions {F0, F1, F2, . . . Fr}, each function of which comprises one or more statements and/or declarations;
- defining for said source computer program P, a set of tasks T={T1, T2, . . . Tn} able to be performed by said source computer program P;
- determining, for each of the tasks Ti in said set of tasks T, a corresponding set of input data sets Ui={ui1, ui2, . . . uip} for task Ti;
- restructuring said source computer program P into a target computer program PR that consists of source code.
The method of claim 27, wherein said predetermined flags include:
- (i) a first flag that indicates that the flagged statement has started execution;
- (ii) a second flag that indicates that the flagged statement has finished execution;
- and
- (iii) a third flag that indicates that the flagged statement has executed one or more times previously during execution of the source computer program P with the same input data uij.
Dependencies are inferred from the claim text.