Method and apparatus for cross calling programs of different lexical scoping methodology
First Claim
1. A method of calling a program written in a language of one scope from a program written in a language of another scope, the method comprising the following steps:
- storing a name of the called program and its scope as dynamic or static;
in response to detection of a reference to a variable in the called program, determining if the scope of the called program is dynamic orif the scope of the called program is determined to be dynamic, providing to the called program a value associated with the variable'"'"'s latest declaration; and
if the scope of the called program is determined to be static, providing to the called program a value associated with the variable'"'"'s latest active declaration.
1 Assignment
0 Petitions
Accused Products
Abstract
A method for enabling a computer program written in one scope to call a program written in another scope. The calling program may be statically or dynamically scoped and may call programs that are of a different scope. In a preferred embodiment of the invention, the method includes providing a call stack for programs called in the program, the call stack storing the names of the programs via a pointer and the dynamic or static scope of the called programs. The name pointer of a called program and its scope are pushed onto the call stack. For each non-local variable referenced in the called program, a lookup routine is followed. If the called program is dynamically scoped, the value associated with the variable'"'"'s latest entry in its attribute stack is provided. If the called program is statically scoped, the value associated with the variable'"'"'s latest active entry in the attribute stack is provided. In this way the scope of the called program is maintained even though the scope of the calling environment may differ.
15 Citations
15 Claims
-
1. A method of calling a program written in a language of one scope from a program written in a language of another scope, the method comprising the following steps:
-
storing a name of the called program and its scope as dynamic or static; in response to detection of a reference to a variable in the called program, determining if the scope of the called program is dynamic or if the scope of the called program is determined to be dynamic, providing to the called program a value associated with the variable'"'"'s latest declaration; and if the scope of the called program is determined to be static, providing to the called program a value associated with the variable'"'"'s latest active declaration. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A method of calling a program written in a language of one scope from a program written in a language of another scope, the method comprising the following steps:
-
providing a call stack for programs called in the program, the call stack storing the names of the programs called and the scope of the called programs as static or dynamic; providing an attribute stack for each variable named in the program, the attribute stack storing an entry for each declaration of the variable in the program and an indication whether that entry is active or inactive; pushing onto the call stack the name of a called program and its scope; and for a variable referenced in a called program; determining if the called program is dynamically or statically scoped; if the called program is dynamically scoped, providing to the called program a value associated with the variable'"'"'s latest entry in its attribute stack; and if the called program is statically scoped, providing to the called program a value associated with the variable'"'"'s latest active entry in its attribute stack. - View Dependent Claims (10)
-
-
11. Apparatus for calling a program written in a language of one scope from a program written in a language of another scope, comprising:
-
means for storing a name of a called program and its scope as dynamic or static; means for determining if the scope of the called program is dynamic or static in response to detection of a reference to a variable in the called program; and means for performing the following steps; if the scope of the called program is determined to be dynamic, providing to the called program a value associated with the variable'"'"'s latest declaration; and if the scope of the called program is determined to be static, providing to the called program a value associated with the variable'"'"'s latest active declaration. - View Dependent Claims (12, 13, 14)
-
-
15. Apparatus for calling a program written in a language of one scope from a program written in a language of another scope, comprising:
-
a central processing unit; memory; a call stack stored in memory for programs called in the calling program, the call stack storing the names of the programs called and the scope of the called programs as static or dynamic; and an attribute stack stored in memory for variables named in the calling program, the attribute stack storing an entry for each declaration of the variable in the calling program and an indication whether that entry is active or inactive. whereby if a called program is dynamically scoped, a value associated with the variable'"'"'s latest entry in its attribute stack is provided to the called program, and if a called program is statically scoped, a value associated with the variable'"'"'s latest active entry in its attribute stack is provided to the called program.
-
Specification