Meta-programming methods and apparatus
First Claim
1. A method of programming a computer comprising the steps of:
- generating a first function routine including a first label representing a code argument; and
generating a first program segment including;
i. a first directive which defines the first label to be a first block of code; and
ii. a second directive which instructs a preprocessor to include the first function routine into the first program segment after the first directive.
2 Assignments
0 Petitions
Accused Products
Abstract
The described programming techniques allow for the passing of code arguments to functions, referred to as meta-functions, at compile time through the use of compiler directives. Methods for implementing functions, referred to as meta-loops, which allow for a block of code to be repeated a variable number of times at compile time are also described. The programming methods of the present invention allow for greater code reuse since code arguments can be used to modify the functionality of a meta-function thereby altering its functionality. Meta-functions and meta-loops can also be used to generate a group of functions which share common behaviors. In accordance with the present invention the common behaviors are produced via the use of a common meta-function. This allows the behavior of a group of functions to be altered. This reduces the time and expense associated with creating and maintaining libraries of functions with shared behaviors. Because the programming methods of the present invention can be implemented using compiler commands and functionality supported by existing compiled languages such as C++ they serve to supplement and argument the functionality of existing compiled languages without requiring modifications thereto.
31 Citations
31 Claims
-
1. A method of programming a computer comprising the steps of:
-
generating a first function routine including a first label representing a code argument; and generating a first program segment including; i. a first directive which defines the first label to be a first block of code; and ii. a second directive which instructs a preprocessor to include the first function routine into the first program segment after the first directive. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25)
-
-
26. A system comprising:
-
a processor for executing computer programs; a memory device coupled to the processor for storing files including program segments, computer programs and computer functions; means for generating a first function routine including on undefined first label representing a code argument; means for storing the first function routine in a first file; means for generating a first program segment including; a first compiler directive which instructs a compiler to replace subsequent occurrences of the first label in the first function routine with a first block of code; and a second compiler directive which instructs a compiler to incorporate the contents of the first file into the first program segment. - View Dependent Claims (27, 28, 29, 30)
-
-
31. A method of programming a computer, comprising the steps of:
-
generating a function routine; generating a code argument to be included in the function routine; generating, subsequent to the generation of the function routine, a parameter indicating the number of times the code argument is to be repeated within the function routine; generating, as a function of the code argument and the parameter, a computer program including the function routine, the function routine including the code argument repeated the number of times indicated by the control parameter.
-
Specification