JP2768073B2 - Mutual call method between programs - Google Patents

Mutual call method between programs

Info

Publication number
JP2768073B2
JP2768073B2 JP3226501A JP22650191A JP2768073B2 JP 2768073 B2 JP2768073 B2 JP 2768073B2 JP 3226501 A JP3226501 A JP 3226501A JP 22650191 A JP22650191 A JP 22650191A JP 2768073 B2 JP2768073 B2 JP 2768073B2
Authority
JP
Japan
Prior art keywords
exception
interpreter
program
language
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP3226501A
Other languages
Japanese (ja)
Other versions
JPH0546402A (en
Inventor
雄司 小川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP3226501A priority Critical patent/JP2768073B2/en
Publication of JPH0546402A publication Critical patent/JPH0546402A/en
Application granted granted Critical
Publication of JP2768073B2 publication Critical patent/JP2768073B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明はいくつかの異なるプログ
ラミング言語(以下、単に言語という)によって作成さ
れる情報処理システムにおけるプログラム間相互呼出し
方式に関し、インタプリタと他言語プログラム(そのイ
ンタプリタに係る言語と異なる言語の原始プログラムに
基づいてコンパイラにより作成された目的プログラム)
との間で相互呼出しを行うプログラム間相互呼出し方式
に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an inter-program mutual calling method in an information processing system created in several different programming languages (hereinafter simply referred to as languages). A target program created by a compiler based on a source program in a different language)
And a program-to-program mutual invocation method for mutually invoking between programs.

【0002】[0002]

【従来の技術】近年、計算機による情報処理システムの
多様化および複雑化に伴い、いくつかの言語に係るプロ
グラム(モジュール)が組み合わされて1つの情報処理
システムが構築される機会が増加しつつある。これは、
各言語にはそれぞれに特徴があり、情報処理システムの
構成要素の各プログラムの原始プログラムをそれぞれに
適合した言語によって記述することが望ましいからであ
る。
2. Description of the Related Art In recent years, with the diversification and complexity of information processing systems using computers, opportunities to construct one information processing system by combining programs (modules) related to several languages have been increasing. . this is,
This is because each language has its own characteristics, and it is desirable to describe the source program of each program of the components of the information processing system in a language suitable for each.

【0003】ここで、原始プログラムが異なる言語によ
って記述されている2つのプログラムにおける各呼出し
インタフェースはそれぞれの言語仕様によって異なるた
めに、2つのプログラムの間の呼出しに際してはいずれ
かのプログラムの呼出しインタフェースを他のプログラ
ムに合わせたものに変更する必要が生じる。
[0003] Here, since each call interface in two programs in which a source program is described in different languages differs depending on the respective language specifications, the call interface of one of the programs is used when calling between the two programs. It will be necessary to change it to one for other programs.

【0004】このような情報処理システムにおいて、イ
ンタプリタと他言語プログラムとの間で行われるプログ
ラム間相互呼出し方式は、インタプリタの拡張機能とし
て実現されるのが一般的である。
In such an information processing system, an inter-program mutual calling method performed between an interpreter and a program in another language is generally realized as an extended function of the interpreter.

【0005】従来、この種のプログラム間相互呼出し方
式は、引数情報(プログラム間で引数を適正に伝えるた
めの情報であり、各プログラムにおける命令の内部表現
や引数の値等に関する情報)の変換を行った上でプログ
ラム間の制御の受渡しを行うだけにとどまっていた。
Heretofore, this type of inter-program mutual call method has been used to convert argument information (information for properly transmitting arguments between programs, and information relating to the internal representation of instructions and the values of arguments in each program). After that, they simply passed control between programs.

【0006】[0006]

【発明が解決しようとする課題】上述した従来のプログ
ラム間相互呼出し方式では、インタプリタと他言語プロ
グラムとの間の呼出しインタフェースにおいて、引数情
報の変換だけが行われており、例外処理に関する定義状
態の変更は行われていないので、インタプリタおよび他
言語プログラムにおける例外処理の適正な実行が保証さ
れず、一方のプログラム(インタプリタまたは他言語プ
ログラム)における適正でない例外処理の実行により他
のプログラム(他言語プログラムまたはインタプリタ)
の実行に悪影響を与えるおそれがあるという欠点があっ
た。
In the above-mentioned conventional inter-program inter-call method, only the conversion of argument information is performed in the call interface between the interpreter and the program in another language, and the definition state of exception processing is defined. Since no change has been made, proper execution of exception handling in the interpreter and other language programs is not guaranteed, and execution of inappropriate exception handling in one program (interpreter or other language program) causes another program (other language program) to execute. Or interpreter)
There is a drawback that the execution may be adversely affected.

【0007】近年のように情報処理システムが高度化す
ると、情報処理システムのスタイルがデータをトップダ
ウンに処理するデータ指向のスタイルからリアルタイム
な利用者からの要求を処理するイベント(事象)指向の
スタイルに移行しつつある。イベント指向の情報処理シ
ステムにおいては、同期的な例外事象(不正アドレス参
照や算術オーバフロー等)の他に非同期的な例外事象
(利用者による割込みキーの押下やマウスの操作等)が
発生しやすいので、インタプリタおよび他言語プログラ
ムにおいて適正な例外処理の実行が保証されないという
上記欠点は特に深刻なものとなる。
[0007] As the information processing system becomes more sophisticated as in recent years, the style of the information processing system is changed from a data-oriented style for processing data top down to an event-oriented style for processing real-time user requests. It is shifting to. In an event-oriented information processing system, in addition to synchronous exceptional events (illegal address reference, arithmetic overflow, etc.), asynchronous exceptional events (user pressing an interrupt key, operating a mouse, etc.) are likely to occur. The above drawback that proper execution of exception handling is not guaranteed in interpreters and other language programs is particularly serious.

【0008】本発明の目的は、上述の点に鑑み、インタ
プリタおよび他言語プログラムにおける適正な例外処理
の実行を保証することができるプログラム間相互呼出し
方式を提供することにある。
SUMMARY OF THE INVENTION An object of the present invention is to provide a program-to-program mutual call system which can guarantee the execution of appropriate exception processing in an interpreter and a program in another language.

【0009】[0009]

【課題を解決するための手段】本発明のプログラム間相
互呼出し方式は、インタプリタと他言語プログラムとの
間のプログラム間相互呼出し方式において、例外状態情
が設定される例外捕獲機構と、前記例外捕獲機構内
例外状態情報をインタプリタ例外状態情報から他言語プ
ログラム例外状態情報に変更したり、他言語プログラム
例外状態情報からインタプリタ例外状態情報に変更した
する例外状態変更部と、インタプリタが他言語プログ
ラムを呼び出す時に当該呼出しに係る引数情報をインタ
プリタ表現から他言語プログラム表現に変換して制御を
前記例外状態変更部に渡す他言語引数変換部と、前記例
外状態変更部による前記例外捕獲機構内の例外状態情報
のインタプリタ例外状態情報から他言語プログラム例外
状態情報への変更後に他言語プログラムに制御を渡し、
他言語プログラムにおける当該呼出しに係る処理が終了
した後に前記例外状態変更部に制御を戻す他言語制御渡
し部と、前記例外状態変更部による前記例外捕獲機構内
の例外状態情報の他言語プログラム例外状態情報からイ
ンタプリタ例外状態情報への変更後に他言語プログラム
表現の返却値をインタプリタ表現の返却値に変換してイ
ンタプリタに渡すインタプリタ返却値変換部と、他言語
プログラムがインタプリタを呼び出す時に当該呼出しに
係る引数情報を他言語プログラム表現からインタプリタ
表現に変換して制御を前記例外状態変更部に渡すインタ
プリタ引数変換部と、前記例外状態変更部による前記例
外捕獲機構内の例外状態情報の他言語プログラム例外状
態情報からインタプリタ例外状態情報への変更後にイン
タプリタに制御を渡し、インタプリタにおける当該呼出
しに係る処理が終了した後に前記例外状態変更部に制御
を戻すインタプリタ制御渡し部と、前記例外状態変更部
による前記例外捕獲機能内の例外状態情報のインタプリ
タ例外状態情報から他言語プログラム例外状態情報への
変更後にインタプリタ表現の返却値を他言語プログラム
表現の返却値に変換して他言語プログラムに渡す他言語
返却値変換部とを有する。
Means for Solving the Problems] program mutual calling system of the present invention, in the program mutual call method between the interpreter and other language programs, and exception trapping mechanism exception state is set, the exception capture The exception status information in the mechanism was changed from interpreter exception status information to other language program exception status information, or from other language program exception status information to interpreter exception status information .
And the exception state changing unit that Ri, interpreter other language programming
When calling the program, the argument information related to the call is
Converting from a printer expression to another language program expression for control
The other language argument conversion unit to be passed to the exception state change unit, and the example
Exception status information in the exception trapping mechanism by the external status change unit
Other language program exception from the interpreter exception status information
After the change to the state information, pass control to another language program,
Processing related to the call in the other language program ends
Other language control that returns control to the exception status change unit after
And the exception trapping mechanism by the exception state changing unit.
From other language program exception status information
Other language program after changing to interpreter exception status information
Convert the expression return value to the interpreter expression return value
Interpreter return value converter to be passed to interpreter and other languages
When a program calls the interpreter,
Interpret such argument information from other language program expression
An interface that converts the expression into an expression and passes control to the exception state change unit.
The example by the pretty argument conversion unit and the exception status change unit
Multi-language program exception status of exception status information in external capture mechanism
State after changing from status information to interpreter exception status information.
Transfers control to the interpreter and calls the interpreter
Control by the exceptional state change unit after the process related to
An interpreter control passing unit for returning
Interpretation of exception status information in the exception catching function
From program exception status information to other language program exception status information
After the change, return the interpreted expression return value to another language program
Other languages that are converted to expression return values and passed to other language programs
A return value conversion unit .

【0010】[0010]

【作用】本発明のプログラム間相互呼出し方式では、例
外捕獲機構が例外状態情報を設定しており、例外状態変
更部が例外捕獲機構内例外状態情報をインタプリタ例
外状態情報から他言語プログラム例外状態情報に変更し
たり、他言語プログラム例外状態情報からインタプリタ
例外状態情報に変更したりする。インタプリタが他言語
プログラムを呼び出す時に、他言語引数変換部は当該呼
出しに係る引数情報をインタプリタ表現から他言語プロ
グラム表現に変換して制御を例外状態変更部に渡し、他
言語制御渡し部は例外状態変更部による例外捕獲機構内
の例外状態情報のインタプリタ例外状態情報から他言語
プログラム例外状態情報への変更後に他言語プログラム
に制御を渡し、他言語プログラムにおける当該呼出しに
係る処理が終了した後に例外状態変更部に制御を戻し、
インタプリタ返却値変換部は例外状態変更部による例外
捕獲機構内の例外状態情報の他言語プログラム例外状態
情報からインタプリタ例外状態情報への変更後に他言語
プログラム表現の返却値をインタプリタ表現の返却値に
変換してインタプリタに渡す。他言語プログラムがイン
タプリタを呼び出す時に、インタプリタ引数変換部は当
該呼出しに係る引数情報を他言語プログラム表現からイ
ンタプリタ表現に変換して制御を例外状態変更部に渡
し、インタプリタ制御渡し部は例外状態変更部による例
外捕獲機構内の例外状態情報の他言語プログラム例外状
態情報からインタプリタ例外状態情報への変更後にイン
タプリタに制御を渡し、インタプリタにおける当該呼出
しに係る処理が終了した後に例外状態変更部に制御を戻
し、他言語返却値変換部は例外状態変更部による例外捕
獲機能内の例外状態情報のインタプリタ例外状態情報か
ら他言語プログラム例外状態情報への変更後にインタプ
リタ表現の返却値を他言語プログラム表現の返却値に変
換して他言語プログラムに渡す。
According to the inter-program inter-call method of the present invention, the exception catching mechanism sets the exception status information, and the exception status changing unit changes the exception status information in the exception catching status from the interpreter exception status information to the other language program exception status. Change to information
Or, or to change the interpreter exception state information from other language programs exception state information. Interpreter is in another language
When calling the program, the other language argument conversion unit
From the interpreter expression
To the exception state change part, and
Language control passing part is in exception trapping mechanism by exception state changing part
Interpreter of the exception status information of the other language from the exception status information
Other language program after changing to program exception status information
Control to the other language program
After such processing is completed, control is returned to the exception state changing unit,
Interpreter return value conversion part is exception by exception state change part
Multilingual program exception status of exception status information in the capture mechanism
Other language after changing information to interpreter exception status information
Return value of program expression to return value of interpreter expression
Convert and pass to interpreter. Other language programs
When calling the interpreter, the interpreter argument converter
The argument information related to the call can be obtained from other language program expression.
Converted to interpreted representation and passed control to exception status change part
However, the interpreter control passing part is an example of the exception state changing part.
Multi-language program exception status of exception status information in external capture mechanism
State after changing from status information to interpreter exception status information.
Transfers control to the interpreter and calls the interpreter
Control is returned to the exceptional state change unit after the process related to
However, the other language return value conversion part catches the exception by the exception state change part.
Is the interpreter exception status information of the exception status information in the catch function?
After changing to the other language program exception status information
Change the return value of Rita expression to the return value of other language program expression
And pass it to another language program.

【0011】[0011]

【実施例】次に、本発明について図面を参照して詳細に
説明する。
Next, the present invention will be described in detail with reference to the drawings.

【0012】図1は、本発明のプログラム間相互呼出し
方式の一実施例の構成を示すブロック図である。
FIG. 1 is a block diagram showing the configuration of an embodiment of the inter-program mutual calling method according to the present invention.

【0013】本実施例のプログラム間相互呼出し方式
は、例外状態再設定手段1と、インタプリタ2と、他言
語プログラム3と、他言語引数変換部4と、他言語制御
渡し部6と、インタプリタ返却値変換部7と、インタプ
リタ制御渡し部11と、インタプリタ引数変換部12
と、他言語返却値変換部13とを含んで構成されてい
る。なお、例外状態再設定手段1,他言語引数変換部
4,他言語制御渡し部6,インタプリタ返却値変換部
7,インタプリタ制御渡し部11,インタプリタ引数変
換部12および他言語返却値変換部13は、インタプリ
タ2の拡張機能として実現される。
The inter-program mutual invocation method of this embodiment includes an exceptional state resetting means 1, an interpreter 2, another language program 3, another language argument conversion unit 4, another language control passing unit 6, and an interpreter return. Value converter 7, interpreter control passing unit 11, and interpreter argument converter 12
And another language return value conversion unit 13. The exception state resetting means 1, the other language argument conversion unit 4, the other language control passing unit 6, the interpreter return value conversion unit 7, the interpreter control passing unit 11, the interpreter argument conversion unit 12, and the other language return value conversion unit 13 , Is implemented as an extended function of the interpreter 2.

【0014】例外状態再設定手段1は、インタプリタ2
が他言語プログラム3を呼び出す時に例外捕獲機構9内
に設定されている例外状態情報をインタプリタ例外状態
情報8から他言語プログラム例外状態情報10に変更し
他言語プログラム3がインタプリタ2を呼び出す時に例
外捕獲機構9内に設定されている例外状態情報を他言語
プログラム例外状態情報10からインタプリタ例外状態
情報8に変更する例外状態変更部5と、インタプリタ2
の実行時における例外状態情報(いくつかの例外事象と
各例外事象の発生時に行われるべき例外処理を特定(定
義)するための情報との対応を示す情報)であるインタ
プリタ例外状態情報8と、現時点での例外状態情報を記
憶している例外捕獲機構9と、他言語プログラム3の実
行時における例外状態情報である他言語プログラム例外
状態情報10とを含んで構成されている(図1中のイン
タプリタ例外状態情報8と例外捕獲機構9との間の実線
および例外捕獲機構9と他言語プログラム例外状態情報
10との間の破線は、図1に示す時点で例外捕獲機構9
内にインタプリタ例外状態情報8が設定されていること
を示している)。
The exception state resetting means 1 includes an interpreter 2
Changes the exception status information set in the exception catching mechanism 9 when the other language program 3 calls the interpreter 2 from the interpreter exception status information 8 to the other language program exception status information 10 when the other language program 3 calls the interpreter 2. An exception status change unit 5 for changing the exception status information set in the mechanism 9 from the foreign language program exception status information 10 to the interpreter exception status information 8;
Interpreter exception state information 8 which is exception state information (information indicating correspondence between some exception events and information for specifying (defining) exception processing to be performed when each exception event occurs) at the time of execution of It is configured to include an exception catching mechanism 9 that stores the current exception state information, and another language program exception state information 10 that is exception state information when the other language program 3 is executed (see FIG. 1). The solid lines between the interpreter exception state information 8 and the exception catching mechanism 9 and the broken lines between the exception catching mechanism 9 and the foreign language program exception state information 10 indicate the exception catching mechanism 9 at the time shown in FIG.
Indicates that the interpreter exceptional state information 8 is set in the command.)

【0015】図2(a)は、LISPプログラムにおけ
る関数定義の一例を示す図である。
FIG. 2A shows an example of a function definition in a LISP program.

【0016】図2(b)は、Cプログラムにおける関数
定義の一例を示す図である。
FIG. 2B is a diagram showing an example of a function definition in a C program.

【0017】図3は、本実施例のプログラム間相互呼出
し方式の具体的な動作を説明するための図である。
FIG. 3 is a diagram for explaining a specific operation of the inter-program mutual call method according to the present embodiment.

【0018】次に、このように構成された本実施例のプ
ログラム間相互呼出し方式の動作について説明する。
Next, the operation of the program-to-program mutual invocation system of the present embodiment configured as described above will be described.

【0019】第1に、インタプリタ2が処理の過程で他
言語プログラム3を呼び出す場合の動作を説明する。
First, the operation when the interpreter 2 calls the foreign language program 3 in the course of processing will be described.

【0020】他言語引数変換部4は、当該呼出しに係る
引数情報をインタプリタ表現(インタプリタ2における
表現)から他言語プログラム表現(他言語プログラム3
における表現)に変換する。
The other language argument conversion unit 4 converts the argument information relating to the call from an interpreter expression (expression in the interpreter 2) into another language program expression (other language program 3).
In the expression).

【0021】例外状態再設定手段1内の例外状態変更部
5は、例外捕獲機構9内に設定されている例外状態情報
をインタプリ例外状態情報8から他言語プログラム例外
状態情報10に変更する。
The exceptional state changing unit 5 in the exceptional state resetting means 1 changes the exceptional state information set in the exception catching mechanism 9 from the interpreted exceptional state information 8 to the foreign language program exceptional state information 10.

【0022】他言語制御渡し部6は、他言語引数変換部
4における変換および例外状態変更部5における変更の
後に、他言語プログラム3に制御を渡す。
The other language control transfer section 6 transfers control to the other language program 3 after the conversion in the other language argument conversion section 4 and the change in the exceptional state change section 5.

【0023】第2に、以上のようにして呼び出された他
言語プログラム3が当該呼出しに係る処理を終えて返却
値をインタプリタ2に戻す場合の動作を説明する。
Second, the operation when the multilingual program 3 called as described above completes the processing related to the call and returns the return value to the interpreter 2 will be described.

【0024】他言語プログラム3における当該呼出しに
係る処理が終了し他言語制御渡し部6に制御が戻される
と、他言語制御渡し部6は例外状態再設定手段1内の例
外状態変更部5に制御を渡す。
When the process related to the call in the other language program 3 is completed and the control is returned to the other language control passing unit 6, the other language control passing unit 6 sends the message to the exception state changing unit 5 in the exception state resetting means 1. Pass control.

【0025】例外状態変更部5は、例外捕獲機構9内に
設定されている例外状態情報を他言語プログラム例外状
態情報10からインタプリタ例外状態情報8に戻す。
The exception status change unit 5 returns the exception status information set in the exception catching mechanism 9 from the foreign language program exception status information 10 to the interpreter exception status information 8.

【0026】インタプリタ返却値変換部7は、他言語プ
ログラム表現の返却値をインタプリタ表現に変換し、変
換後の返却値をインタプリタ2に渡す。
The interpreter return value converter 7 converts the return value of the other language program expression into an interpreter expression, and passes the converted return value to the interpreter 2.

【0027】第3に、インタプリタ2から呼び出された
他言語プログラム3が当該呼出しに係る処理の過程で逆
にインタプリタ2を呼び出す場合の動作を説明する。
Third, the operation when the other language program 3 called from the interpreter 2 calls the interpreter 2 in the process of the process related to the call will be described.

【0028】インタプリタ引数変換部12は、他言語プ
ログラム3からインタプリタ2への呼出しに係る引数情
報を他言語プログラム表現からインタプリタ表現に変換
する。
The interpreter argument conversion unit 12 converts argument information relating to a call from another language program 3 to the interpreter 2 from another language program expression to an interpreter expression.

【0029】例外状態再設定手段1内の例外状態変更部
5は、例外捕獲機構9内に設定されている例外状態情報
を他言語プログラム例外状態情報10からインタプリタ
例外状態情報8に変更する。
The exception status change unit 5 in the exception status resetting means 1 changes the exception status information set in the exception catching mechanism 9 from the foreign language program exception status information 10 to the interpreter exception status information 8.

【0030】インタプリタ制御渡し部11は、インタプ
リタ引数変換部12における変換および例外状態変更部
5における変更の後に、インタプリタ2に制御を渡す。
The interpreter control transfer section 11 transfers control to the interpreter 2 after the conversion in the interpreter argument conversion section 12 and the change in the exception state change section 5.

【0031】第4に、以上のようにして呼び出されたイ
ンタプリタ2が当該呼出しに係る処理を終えて返却値を
他言語プログラム3に戻す場合の動作を説明する。
Fourth, the operation in the case where the interpreter 2 called as described above completes the processing related to the call and returns the return value to the foreign language program 3 will be described.

【0032】インタプリタ2における当該呼出しに係る
処理が終了しインタプリタ制御渡し部11に制御が戻さ
れると、インタプリタ制御渡し部11は例外状態再設定
手段1内の例外状態変更部5に制御を渡す。
When the processing related to the call in the interpreter 2 is completed and the control is returned to the interpreter control passing section 11, the interpreter control passing section 11 passes control to the exceptional state changing section 5 in the exceptional state resetting means 1.

【0033】例外状態変更部5は、例外捕獲機構9内に
設定されている例外状態情報をインタプリタ例外状態情
報8から他言語プログラム例外状態情報10に戻す。
The exception status changing unit 5 returns the exception status information set in the exception catching mechanism 9 from the interpreter exception status information 8 to the foreign language program exception status information 10.

【0034】他言語返却値変換部13は、インタプリタ
表現の返却値を他言語プログラム表現に変換し、変換後
の返却値を他言語プログラム3に渡す。
The other language return value converter 13 converts the interpreted expression return value into the other language program expression, and passes the converted return value to the other language program 3.

【0035】次に、図2(a)および(b)ならびに図
3を参照して、本実施例のプログラム間相互呼出し方式
の具体的な動作について説明する。
Next, referring to FIGS. 2A and 2B and FIG. 3, a specific operation of the inter-program mutual calling method of this embodiment will be described.

【0036】今、図1中のインタプリタ2がLISPイ
ンタプリタであり他言語プログラム3がC言語プログラ
ム(Cプログラムを原始プログラムとする目的プログラ
ム)である場合の動作について考える(図3中の「LI
SPインタプリタ」には、その拡張機能である図1中の
例外状態再設定手段1,他言語引数変換部4,他言語制
御渡し部6,インタプリタ返却値変換部7,インタプリ
タ制御渡し部11,インタプリタ引数変換部12および
他言語返却値変換部13が含まれている)。
Now, consider the operation when the interpreter 2 in FIG. 1 is a LISP interpreter and the other language program 3 is a C language program (a target program having a C program as a source program) (“LI” in FIG. 3).
The "SP interpreter" includes, as its extended functions, the exceptional state resetting means 1, the other language argument converter 4, the other language control passing unit 6, the interpreter return value converter 7, the interpreter control passing unit 11, the interpreter It includes an argument conversion unit 12 and a foreign language return value conversion unit 13).

【0037】LISPインタプリタに係るインタプリタ
例外状態情報8およびC言語プログラムに係る他言語プ
ログラム例外状態情報10においては、利用者による割
込みキーの押下という非同期的な例外事象に対して次の
ような例外処理が定義されているものとする。 インタプリタ例外状態情報8:「LISPインタプ
リタを中断するための割込みキーの押下と認識し関数b
reakを呼び出す」 他言語プログラム例外状態情報10:「その割込み
キーの押下を無視する」
In the interpreter exception state information 8 relating to the LISP interpreter and the other language program exception state information 10 relating to the C language program, the following exception processing is performed for the asynchronous exception event that the user presses the interrupt key. Is defined. Interpreter exception status information 8: "Function b which recognizes that the interrupt key for interrupting the LISP interpreter has been pressed
call "reak" Other language program exception status information 10: "Ignore pressing of the interrupt key"

【0038】LISPインタプリタに係るLISPプロ
グラム中で定義されている関数bar(図2(a)参
照)は、引数を1つとり、その引数を2で割った結果を
戻す関数である。
The function bar (see FIG. 2A) defined in the LISP program relating to the LISP interpreter is a function that takes one argument and returns a result obtained by dividing the argument by two.

【0039】C言語プログラムに係るCプログラム中で
定義されている関数foo(図2(b)参照)は、与え
られた引数をそのまま関数barに与えて、その結果に
1を加えた値を戻す関数である。また、関数fooの中
に存在する関数signalは、例外捕獲機構9に対し
て「プログラム実行中に割込みキーが押されてもそれを
無視する」という例外処理を要求している。
A function foo (see FIG. 2B) defined in a C program relating to a C language program gives a given argument to a function bar as it is, and returns a value obtained by adding 1 to the result. Function. The function signal present in the function foo requests the exception catching mechanism 9 to perform an exception process such as "ignore the interrupt key pressed during the execution of the program".

【0040】LISPインタプリタにおける拡張機能
(本実施例のプログラム間相互呼出し方式における機
能)は、異なる言語によって定義されている上述の関数
を言語の区別なく利用できる環境を提供する。
The extended function in the LISP interpreter (the function in the inter-program mutual calling method of the present embodiment) provides an environment in which the above-described functions defined in different languages can be used regardless of the language.

【0041】以上のようなインタプリタ例外状態情報8
および他言語プログラム例外状態情報10ならびに関数
barおよび関数fooの定義を前提として、「(fo
o10)」がLISPインタプリタ上で実行される場合
(後述するようにこの実行結果は「6」になる)の動作
について説明する(図3参照)。
The interpreter exception status information 8 as described above
And the definition of the function bar and the function foo, and
o10) ”is executed on the LISP interpreter (the execution result is“ 6 ”as described later) (see FIG. 3).

【0042】 LISPインタプリタ上で「(foo
10)」の実行が要求される(これにより、LISP
インタプリタはC言語プログラムを呼び出す必要を認識
する)。
On the LISP interpreter, “(foo
10) ”is required (this results in LISP
The interpreter recognizes the need to call a C language program).

【0043】−1 LISPインタプリタの拡張機能
として実現される他言語引数変換部4は、引数情報の変
換を行う。すなわち、「(foo 10)」のLISP
インタプリタでの内部表現から「(foo 10)」の
C言語プログラムでの内部表現への変換等を行う。
-1 The other language argument conversion unit 4 implemented as an extended function of the LISP interpreter converts argument information. That is, the LISP of “(foo 10)”
The conversion from the internal representation in the interpreter to the internal representation of “(foo 10)” in the C language program is performed.

【0044】「(foo 10)」のLISPインタプ
リタでの内部表現は、2つのポインタで表現されるセル
が2つ用意され、1つ目のセルの第1ポインタにシンボ
ル「foo」へのポインタが設定されて第2ポインタに
2つ目のセルへのポインタが設定され、2つ目のセルの
第1ポインタに引数である整数「10」が設定されて第
2ポインタに終端を示す値が設定されて表現されるもの
である。また、「(foo 10)」のC言語プログラ
ムでの内部表現は、引数である整数「10」がスタック
の先頭に置かれ、スタックポインタspがその位置を指
しているものである。
In the internal representation of “(foo 10)” in the LISP interpreter, two cells represented by two pointers are prepared, and the first pointer of the first cell is a pointer to the symbol “foo”. A pointer to the second cell is set in the second pointer, an integer "10" as an argument is set in the first pointer of the second cell, and a value indicating the end is set in the second pointer. It is expressed as In the internal representation of “(foo 10)” in the C language program, the integer “10” as an argument is placed at the top of the stack, and the stack pointer sp points to that position.

【0045】−2 引数情報の変換が終了すると、例
外状態変更部5は例外捕獲機構9内に設定されている例
外状態情報をインタプリタ例外状態情報8(LISP例
外状態情報)から他言語プログラム例外状態情報10
(C例外状態情報)に変更する。
-2 When the conversion of the argument information is completed, the exceptional state changing unit 5 converts the exceptional state information set in the exception catching mechanism 9 from the interpreter exceptional state information 8 (LISP exceptional state information) to the other language program exceptional state. Information 10
(C exception state information).

【0046】−3 他言語制御渡し部6は、関数fo
oに制御を渡すことにより、C言語プログラムに制御を
渡す。
-3 The other-language control passing unit 6 has a function fo
By passing control to o, control is passed to the C language program.

【0047】以上の−1〜−3が、LISPインタ
プリタにおけるC言語プログラムの呼出しのための処理
(インタフェース処理)である。
The above-mentioned steps -1 to -3 are the processing (interface processing) for calling the C language program in the LISP interpreter.

【0048】 呼び出されたC言語プログラムは、関
数fooの引数に続いてスタックに関数fooの呼出し
元のアドレス(他言語制御渡し部6への戻り番地)を退
避し、関数barに与える引数(「10」)をさらにそ
の上に設定して関数barの実行のためにインタプリタ
2を呼び出す(スタックの最上位には他言語プログラム
3への戻り番地が設定される)。
The called C language program saves the address of the caller of the function foo (the return address to the other language control passing unit 6) on the stack following the argument of the function foo, and returns the argument (“ 10 ") is further set thereon, and the interpreter 2 is called to execute the function bar (the return address to the other language program 3 is set at the top of the stack).

【0049】−1 LISPインタプリタの拡張機能
として実現されるインタプリタ引数変換部12は、引数
情報の変換(「(bar 10)」のC言語プログラム
での内部表現からLISPインタプリタでの内部表現へ
の変換等)を行う。
-1 The interpreter argument conversion unit 12 realized as an extended function of the LISP interpreter converts the argument information (conversion from the internal representation of "(bar 10)" in the C language program to the internal representation in the LISP interpreter. Etc.).

【0050】−2 引数情報の変換が終了すると、例
外状態変更部5は例外捕獲機構9内に設定されている例
外状態情報をC例外状態情報からLISP例外状態情報
に変更する。
When the conversion of the argument information is completed, the exceptional state changing unit 5 changes the exceptional state information set in the exception catching mechanism 9 from the C exceptional state information to the LISP exceptional state information.

【0051】−3 インタプリタ制御渡し部11を介
して制御を渡されたLISPインタプリタの本体(拡張
機能以外の部分であり、図1中のインタプリタ2に相当
する部分)は、「(bar 10)」を実行しその実行
結果(返却値)の「5」を得る。なお、LISPインタ
プリタは返却値をレジスタAに格納するものとする。
-3 The main body of the LISP interpreter (the part other than the extended function and corresponding to the interpreter 2 in FIG. 1) to which control has been passed through the interpreter control passing unit 11 is "(bar 10)". To obtain “5” of the execution result (return value). It is assumed that the LISP interpreter stores the return value in the register A.

【0052】−4 インタプリタ制御渡し部11を介
して制御を渡された例外状態変更部5は、例外捕獲機構
9内に設定されている例外状態情報をLISP例外状態
情報からC例外状態情報に戻す。
-4 The exceptional state changing unit 5 to which control has been passed through the interpreter control passing unit 11 returns the exceptional state information set in the exception catching mechanism 9 from the LISP exceptional state information to the C exceptional state information. .

【0053】−5 他言語返却値変換部13は、返却
値の表現をLISPインタプリタ表現からC言語プログ
ラム表現に変換する。なお、C言語プログラムは返却値
をレジスタRに格納するものとする。
-5 The other language return value converter 13 converts the expression of the return value from the LISP interpreter expression to the C language program expression. The C language program stores the return value in the register R.

【0054】以上の−1〜−5が、C言語プログラ
ムから呼び出されてC言語プログラムに制御を戻すまで
のLISPインタプリタにおける処理である。
The above-mentioned steps -1 to -5 are the processing in the LISP interpreter from when called by the C language program to when control is returned to the C language program.

【0055】 関数fooに制御が戻されたC言語プ
ログラムは、関数barから得た値に1を加えた値
「6」をレジスタRに設定して処理を終える。
The C language program whose control has been returned to the function foo sets the value “6” obtained by adding 1 to the value obtained from the function bar in the register R, and ends the processing.

【0056】−1 C言語プログラムにおける関数f
ooの実行が終了すると、他言語制御渡し部6を介して
制御を渡された例外状態変更部5は例外捕獲機構9内に
設定されている例外状態情報をC例外状態情報からLI
SP例外状態情報に変更する。
-1 Function f in C Language Program
When the execution of oo is completed, the exception state changing unit 5 to which control has been passed through the foreign language control passing unit 6 converts the exception state information set in the exception catching mechanism 9 from the C exception state information to the LI.
Change to SP exception status information.

【0057】−2 インタプリタ返却値変換部7は、
返却値の表現をC言語プログラム表現からLISPイン
タプリタ表現に変換し、LISPインタプリタの本体に
制御を戻す。
-2 The interpreter return value conversion unit 7
The expression of the return value is converted from the C language program expression to the LISP interpreter expression, and control is returned to the main body of the LISP interpreter.

【0058】 LISPインタプリタの本体は、
「(foo 10)」の実行結果として「6」を得て、
通常のインタプリタ状態に戻る。
The main body of the LISP interpreter is
"6" is obtained as an execution result of "(foo 10)",
Return to normal interpreter state.

【0059】以上の処理の過程で(関数fooが起動さ
れてからその実行結果が得られるまでの間に)、利用者
により割込みキーが押されたとすると、例外捕獲機構9
内の例外状態情報に基づいて次のような例外処理が行わ
れる。 LISPインタプリタの実行中の押下であれば、L
ISPプログラムの割込み処理として関数breakが
呼び出される。 C言語プログラムの実行中の押下であれば、割込み
キーが押されたことは無視される。
If the user presses the interrupt key during the above process (between the time when the function foo is activated and the execution result is obtained), the exception catching mechanism 9
The following exception processing is performed on the basis of the exception state information. If the button is pressed during execution of the LISP interpreter, L
The function break is called as interrupt processing of the ISP program. If the key is pressed during the execution of the C language program, the pressing of the interrupt key is ignored.

【0060】[0060]

【発明の効果】以上説明したように本発明は、例外捕獲
機構および例外状態変更部を含む例外状態再設定手段を
設けることにより、インタプリタと他言語プログラムと
の間の相互呼出しにおいてそれぞれに対応する例外状態
情報の設定が可能になり、インタプリタおよび他言語プ
ログラムにおける適正な例外処理の実行を保証すること
ができるという効果がある。この効果は、非同期的な例
外事象が頻繁に発生するイベント指向の情報処理システ
ムにおいて、特に有効なものになる。
As described above, according to the present invention, by providing the exception state resetting means including the exception catching mechanism and the exception state changing unit, it is possible to cope with the mutual invocation between the interpreter and the other language program. Exceptional state information can be set, and an effect is obtained that execution of appropriate exceptional processing in the interpreter and other language programs can be guaranteed. This effect is particularly effective in an event-oriented information processing system in which asynchronous exceptional events frequently occur.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の一実施例の構成を示すブロック図であ
る。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention.

【図2】(a)はLISPプログラムにおける関数定義
の一例を示す図であり、(b)はCプログラムにおける
関数定義の一例を示す図である。
FIG. 2A is a diagram illustrating an example of a function definition in a LISP program, and FIG. 2B is a diagram illustrating an example of a function definition in a C program.

【図3】図1に示すプログラム間相互呼出し方式の具体
的な動作を説明するための図である。
FIG. 3 is a diagram for explaining a specific operation of the inter-program mutual calling method shown in FIG. 1;

【符号の説明】[Explanation of symbols]

1 例外状態再設定手段 2 インタプリタ 3 他言語プログラム 4 他言語引数変換部 5 例外状態変更部 6 他言語制御渡し部 7 インタプリタ返却値変換部 8 インタプリタ例外状態情報 9 例外捕獲機構 10 他言語プログラム例外状態情報 11 インタプリタ制御渡し部 12 インタプリタ引数変換部 13 他言語返却値変換部 DESCRIPTION OF SYMBOLS 1 Exception state resetting means 2 Interpreter 3 Other language program 4 Other language argument conversion part 5 Exception state change part 6 Other language control passing part 7 Interpreter return value conversion part 8 Interpreter exception state information 9 Exception catching mechanism 10 Other language program exception state Information 11 interpreter control passing unit 12 interpreter argument conversion unit 13 other language return value conversion unit

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 インタプリタと他言語プログラムとの間
のプログラム間相互呼出し方式において、 例外状態情報が設定される例外捕獲機構と、 前記例外捕獲機構内例外状態情報をインタプリタ例外
状態情報から他言語プログラム例外状態情報に変更し
り、他言語プログラム例外状態情報からインタプリタ例
外状態情報に変更したりする例外状態変更部と、インタプリタが他言語プログラムを呼び出す時に当該呼
出しに係る引数情報をインタプリタ表現から他言語プロ
グラム表現に変換して制御を前記例外状態変更部に渡す
他言語引数変換部と、 前記例外状態変更部による前記例外捕獲機構内の例外状
態情報のインタプリタ例外状態情報から他言語プログラ
ム例外状態情報への変更後に他言語プログラムに制御を
渡し、他言語プログラムにおける当該呼出しに係る処理
が終了した後に前記例外状態変更部に制御を戻す他言語
制御渡し部と、 前記例外状態変更部による前記例外捕獲機構内の例外状
態情報の他言語プログラム例外状態情報からインタプリ
タ例外状態情報への変更後に他言語プログラム表現の返
却値をインタプリタ表現の返却値に変換してインタプリ
タに渡すインタプリタ返却値変換部と、 他言語プログラムがインタプリタを呼び出す時に当該呼
出しに係る引数情報を他言語プログラム表現からインタ
プリタ表現に変換して制御を前記例外状態変更部に渡す
インタプリタ引数変換部と、 前記例外状態変更部による前記例外捕獲機構内の例外状
態情報の他言語プログラム例外状態情報からインタプリ
タ例外状態情報への変更後にインタプリタに制御を渡
し、インタプリタにおける当該呼出しに係る処理が終了
した後に前記例外状態変更部に制御を戻すインタプリタ
制御渡し部と、 前記例外状態変更部による前記例外捕獲機能内の例外状
態情報のインタプリタ例外状態情報から他言語プログラ
ム例外状態情報への変更後にインタプリタ表現の返却値
を他言語プログラム表現の返却値に変換して他言語プロ
グラムに渡す他言語返却値変換部と を有することを特徴
とするプログラム間相互呼出し方式。
In the program mutual call method between the 1. A interpreter and other language programs, exceptions and capture mechanism, other languages exception status information from the interpreter exceptional state information in the exception trapping mechanism exception state is set It was changed to the program exception state information
Ri, the call and exception status changing part or change the interpreter exception state from another language program exception state, when the interpreter calls the other language program
From the interpreter expression
And convert control to the exception status change unit
Exception state in the exception catching mechanism by the other language argument conversion unit and the exception state change unit
Interpretation of status information
Control to another language program after changing to
Passing, processing related to the call in the other language program
Other language that returns control to the exception status change unit after completion of
An exception state in the exception catching mechanism by the control passing unit and the exception state changing unit
Interpret state information from other language program exception state information
Returns the language representation of the program after the change to the exception status information
Convert the return value to the return value of the interpreter expression and interpret
The interpreter return value converter to be passed to the interpreter and the other language program call the interpreter when calling the interpreter.
Argument information related to
Convert to a pretty expression and pass control to the exception status change unit
An interpreter argument conversion unit, and an exception state in the exception catching mechanism by the exception state changing unit.
Interpret state information from other language program exception state information
Control to the interpreter after changing to
And the processing related to the call in the interpreter ends.
Interpreter that returns control to the exceptional state change unit after
An exception state in the exception catching function by the control passing unit and the exception state changing unit
Interpretation of status information
Return value of interpreter expression after changing to system exception status information
Is converted to the return value of the other language program expression
And a multi-language return value conversion unit for passing a program to another program.
JP3226501A 1991-08-12 1991-08-12 Mutual call method between programs Expired - Fee Related JP2768073B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3226501A JP2768073B2 (en) 1991-08-12 1991-08-12 Mutual call method between programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3226501A JP2768073B2 (en) 1991-08-12 1991-08-12 Mutual call method between programs

Publications (2)

Publication Number Publication Date
JPH0546402A JPH0546402A (en) 1993-02-26
JP2768073B2 true JP2768073B2 (en) 1998-06-25

Family

ID=16846105

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3226501A Expired - Fee Related JP2768073B2 (en) 1991-08-12 1991-08-12 Mutual call method between programs

Country Status (1)

Country Link
JP (1) JP2768073B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8046777B2 (en) * 2005-06-02 2011-10-25 The Mathworks, Inc. Calling of late bound functions from an external program environment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
「情報処理学会研究報告」 VOL.89,NO.100 (89−SYM−53−2)

Also Published As

Publication number Publication date
JPH0546402A (en) 1993-02-26

Similar Documents

Publication Publication Date Title
JP2801009B2 (en) Method of sending events from keystrokes in a multi-processing computer system
US20100115531A1 (en) Method and system for associating parameters of containers and contained objects
JPH0237454A (en) Computer system
US5551040A (en) Methods and apparatus for specifying the contexts of names in callback-style programming
US6948170B2 (en) Computer and computer-readable storage medium for command interpretation
Bordin et al. Automated model-based generation of ravenscar-compliant source code
JP2768073B2 (en) Mutual call method between programs
Aoyagi et al. Temporal logic programming language Tokio programming in Tokio
US4660142A (en) Digital data processing system employing an object-based addressing system with a single object table
Lane A design space and design rules for user interface software architecture
US5970250A (en) System, method, and computer program product for scoping operating system semanticis in a computing environment supporting multi-enclave processes
US5388263A (en) Procedure state descriptor system for digital data processors
KR101571908B1 (en) A user co-routine interface for customizing sip and sdp protocols
US6769119B1 (en) System, method, and computer program product for scoping operating system semantics in a computing environment supporting multi-enclave processes
US6948159B2 (en) Automatic compilation of electronic telecommunications system message generation code
JP2000122876A (en) Information processor
Takada et al. The ITRON project: Overview and recent results
KR100560393B1 (en) SDL/C language transforming system and method, and its program stored recording medium
McDonald et al. Denotational semantics of a command interpreter and their implementation in Standard ML
EP0892346A2 (en) Propagation of a command status code from a remote unit to a host unit
JPS63254536A (en) Unitary control system for error event
JPH0567049A (en) External command processor
JP3334167B2 (en) Digital computer
EP0892345A2 (en) Method of propagating a command status code from a remote unit to a host unit
JPH04336327A (en) Linking system for object program

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees