JPH0212528A - Procedure subprogram developing system - Google Patents

Procedure subprogram developing system

Info

Publication number
JPH0212528A
JPH0212528A JP63163661A JP16366188A JPH0212528A JP H0212528 A JPH0212528 A JP H0212528A JP 63163661 A JP63163661 A JP 63163661A JP 16366188 A JP16366188 A JP 16366188A JP H0212528 A JPH0212528 A JP H0212528A
Authority
JP
Japan
Prior art keywords
subprogram
statement
procedural
save
program
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.)
Pending
Application number
JP63163661A
Other languages
Japanese (ja)
Inventor
Tomoko Komatsu
小松 智子
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 JP63163661A priority Critical patent/JPH0212528A/en
Publication of JPH0212528A publication Critical patent/JPH0212528A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To develop a procedure subprogram including a SAVE text and to eliminate overhead in the call of the procedure subprogram by adding a mechanism to guarantee an execution result additionally. CONSTITUTION:A procedure subprogram developing mechanism 1 is constituted of a call program analysis part 10, a procedure subprogram analysis part 20, and a program generating part 30. And in case of including the SAVE text in the procedure subprogram, not only the procedure subprogram is developed in a state where the SAVE text is neglected, but a COMMON text to declare a common block with a variable and arrangement designated by the SAVE test and the SAVE text designating the common block with the name are gener ated. And those texts are inserted to a procedure program in which the proce dure subprogram is developed and the procedure subprogram. In such a way, it is possible to eliminate the overhead generated by performing a procedure call at the time of execution.

Description

【発明の詳細な説明】 [産業上の利用分野〕 本発明は、フォートラン(FORTRAN)言語で記述
された原始プログラムにおける手続き副プログラム展開
方式に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a method for expanding a procedural subprogram in a source program written in the FORTRAN language.

〔従来の技術〕[Conventional technology]

CALL文等により成る手続きプログラムから呼び出さ
れる手続き副プログラムを、その呼び出し元の手続きプ
ログラムに展開する従来の手続き副プログラム展開方式
においては、手続き副プログラム内にSAVE文が存在
する場合、それを無視してその手続き副プログラムを展
開すると結果が保証されない場合があるため、それを呼
び出す手続きプログラムに展開することは行っていなか
った。
In the conventional procedure subprogram expansion method, which expands a procedural subprogram called from a procedural program consisting of a CALL statement etc. into the calling procedure program, if a SAVE statement exists in the procedural subprogram, it is ignored. Because the results may not be guaranteed if the procedure subprogram is expanded using a subprogram, the procedure program that calls it is not expanded.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

上述したように従来の手続き副プログラム展開方式は、
手続き副プログラムがS A、 V E文を含んでいる
場合、その手続き副プログラムを、それを呼び出す手続
きプログラムに展開しないので、SAVE文を含む手続
き副プログラムを使用するプログラムでは、手続き副プ
ログラムを呼び出す為のオーバーヘッドが必ず生じてい
た。
As mentioned above, the conventional procedural subprogram expansion method is
If a procedural subprogram contains S A or V E statements, that procedural subprogram is not expanded into a procedural program that calls it, so a program that uses a procedural subprogram that includes a SAVE statement cannot call the procedural subprogram. There was always some overhead involved.

そこで本発明の目的は、実行結果が保証されるような仕
組みを新たに追加することにより、SAVE文を含む手
続き副プログラムの展開を可能にした手続き副プログラ
ム展開方式を提供することにある。
SUMMARY OF THE INVENTION An object of the present invention is to provide a procedural subprogram expansion method that makes it possible to expand a procedural subprogram including a SAVE statement by adding a new mechanism that guarantees execution results.

〔課題を解決するための手段〕[Means to solve the problem]

本発明の手続き副プログラム展開方式は、上記の目的を
達成するために、フォートラン言語で記述された原始プ
ログラム中の手続き副プログラムを、この手続き副プロ
グラムを呼び出す手続きプログラムに展開する手続きI
f!IIプログラム展開方式において、手続き副プログ
ラムを解析する解析部に設けられ、前記手続き副プログ
ラム内にSAVE文が存在するか否かを解析し、存在し
ている場合にはSAVE文で指定されている変数、配列
に関する情報をSAVE文情報テーブルに格納するSA
VE文解析手段と、手続き副プログラムが展開された手
続きプログラムを含む原始プログラムを作成するプログ
ラム作成部に設けられ、前記SAVE文情報テーブルに
基づき、前記手続き副プログラムのSAVE文に指定さ
れた変数、配列を要素に持つ名前付き共通ブロックを宣
言するCOMMON文およびその名前付き共通ブロック
を指定したSAVE文を作成し、前記手続き副プログラ
ムが展開された手続きプログラムおよび前記手続き副プ
ログラムに挿入するCOMMON文ZSAVE文作成挿
入手段とを含んでいる。
In order to achieve the above object, the procedural subprogram expansion method of the present invention expands a procedural subprogram in a source program written in the Fortran language into a procedure program that calls this procedural subprogram.
f! In the II program expansion method, a SAVE statement is provided in an analysis section that analyzes a procedural subprogram, and analyzes whether or not a SAVE statement exists in the procedural subprogram, and if it exists, it is specified in the SAVE statement. SA that stores information about variables and arrays in the SAVE statement information table
a variable specified in the SAVE statement of the procedural subprogram based on the SAVE statement information table; A COMMON statement ZSAVE that creates a COMMON statement that declares a named common block that has an array as an element and a SAVE statement that specifies the named common block, and inserts it into the procedure program in which the procedure subprogram is expanded and the procedure subprogram. and a sentence creation/insertion means.

〔作用〕[Effect]

本発明の手続き副プログラム展開方式においては、手続
き副プログラムを解析する解析部に設けられたSAVE
文解析手段が、手続き副プログラム内にSAVE文が存
在するか否かを解析し、存在している場合にはS A、
 V E文で指定されている変数または/および配列に
関する情報をSAVE文情報テーブルに格納し、手続き
副プログラムが展開された手続きプログラムを含む原始
プログラムを作成するプログラム作成部に設けられたC
OMMON文/SAVE文作成挿入手段が、SAVE文
情報テーブルの内容に基づき、手続き副プログラムのS
AVE文に措定された変数または/および配列を要素に
持つ名前付き共通ブロックを宣言するC OM、 M 
ON文およびその名前付き共通プロ、りを指定したSA
VE文を作成し、これらを手続き副プログラムが展開さ
れた手続きプログラムおよび手続き副プログラムに挿入
する。
In the procedural subprogram development method of the present invention, the SAVE
The statement analysis means analyzes whether or not a SAVE statement exists in the procedural subprogram, and if it exists, S A,
V A C code provided in the program creation section that stores information regarding the variables and/or arrays specified in the E statement in the SAVE statement information table and creates a source program including a procedure program in which a procedural subprogram is expanded.
The OMMON statement/SAVE statement creation/insertion means executes S of the procedure subprogram based on the contents of the SAVE statement information table.
COM, M that declares a named common block whose elements are variables and/or arrays specified in the AVE statement.
SA with ON statement and its named common program, ri
Create VE statements and insert them into the expanded procedure program and procedural subprogram.

〔実施例〕〔Example〕

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

第1図は本発明の一実施例の構成図であり、1は手続き
副プログラム展開プログラム等で実現された手続き副プ
ログラム展開機構、2は手続きQ1プログラム及びこれ
を呼び出す手続きプログラムを含む展開前の原始プログ
ラム200を格納するファイル、3は手続き副プログラ
ムが展開された手続きプログラムおよび加工された手続
き副プログラム等を含む展開後の原始プログラム210
を格納するファイル、12はSAVE文情報テーブルで
ある。また、手続き副プログラム展開機構1内において
、lOは呼び出しプログラム解析部、20は手続き副プ
ログラム解析部、30はプログラム作成部であり、手続
き副プログラム解析部20中にはSAVE文解析部21
が設けられ、プログラム作成部30中にはCOMMON
文/SAVE文作成挿入部31が設けられている。
FIG. 1 is a configuration diagram of an embodiment of the present invention, in which 1 is a procedure subprogram expansion mechanism realized by a procedure subprogram expansion program, etc., 2 is a procedure subprogram expansion mechanism before expansion including a procedure Q1 program and a procedure program that calls this. A file storing the source program 200, 3 is a source program 210 after expansion that includes a procedure program into which a procedural subprogram has been expanded, a processed procedural subprogram, etc.
12 is a SAVE statement information table. In the procedural subprogram expansion mechanism 1, lO is a calling program analysis unit, 20 is a procedural subprogram analysis unit, 30 is a program creation unit, and the procedural subprogram analysis unit 20 includes a SAVE statement analysis unit 21.
COMMON is provided in the program creation section 30.
A statement/SAVE statement creation/insertion section 31 is provided.

手続き副プログラム展開機構1の呼び出しプログラム解
析部lOは、原始プログラム200に含まれる呼び出し
元プログラムをファイル2から人力してプログラム作成
部30に渡すと共に、これを解析して呼び出し元プログ
ラムに手続き副プログラムを呼び出すCALL文等の手
続き副プログラム呼び出し文が存在するか否かを検出し
、この文を検出すると、必要な情報と共にそれを手続き
・副プログラム解析部20に通知するものである。
The calling program analysis unit 1O of the procedural subprogram expansion mechanism 1 manually inputs the calling program included in the source program 200 from the file 2 and passes it to the program creation unit 30, and also analyzes it and converts the calling program into the calling program. It detects whether there is a procedure subprogram call statement such as a CALL statement that calls , and when this statement is detected, it is notified to the procedure/subprogram analysis unit 20 along with necessary information.

また、手続き副プログラム解析部20は呼び出しプログ
ラム解析部10で積出された手続き副プログラム呼び出
し文によって呼び出される手続き副プログラムをファイ
ル2の原始プログラム200から人力してプログラム作
成部30に渡すと共に、これを解析して展開可能な形式
の文を生成してプログラム作成部30に渡す手段である
。このとき、手続き副プログラム解析部20内のSAV
E文解析部21は、手続き副プログラム中にSAVE文
が存在するか否かを解析しており、存在する場合には、
そのSAVE文で指定されている変数または/および配
列に関する情報を抽出してSAVE文情報テーブル12
に格納するものである。プログラム作成部30は、呼び
出しプログラム解析部10および手続き副プログラム解
析部20から渡された各種の情報に従って、手続き副プ
ログラムが展開された手続き副プログラム等を含む原始
プログラム210を生成してファイル3に出力するもの
である。このとき、プログラム作成部30のCOMMO
N文/SAVE文作成挿入部31は、SAVE文情報テ
ーブル12に格納された情報に基づいて、そのSAVE
文に指定された変数または/および配列を要素に持つ名
前付き共通ブロックを宣言するCOMMON文およびそ
の名前付き共通ブロックを指定したSAVE文を作成し
、これらを手続き副プログラムを展開した手続きプログ
ラム及び手続き副プログラムに挿入するものである。
Further, the procedural subprogram analysis unit 20 manually transfers the procedural subprogram called by the procedural subprogram call statement loaded by the calling program analysis unit 10 from the source program 200 of the file 2 to the program creation unit 30. This is means for analyzing and generating a sentence in an expandable format and passing it to the program creation section 30. At this time, the SAV in the procedural subprogram analysis unit 20
The E statement analysis unit 21 analyzes whether a SAVE statement exists in the procedural subprogram, and if it does exist,
Extract information regarding the variables and/or arrays specified in the SAVE statement and save it to the SAVE statement information table 12.
It is stored in . The program creation unit 30 generates a source program 210 including a procedural subprogram, etc., in which a procedural subprogram is expanded, according to various information passed from the calling program analysis unit 10 and the procedural subprogram analysis unit 20, and saves it to file 3. This is what is output. At this time, the COMMO of the program creation section 30
The N statement/SAVE statement creation/insertion unit 31 executes the SAVE statement based on the information stored in the SAVE statement information table 12.
A procedural program and procedure that creates a COMMON statement that declares a named common block whose elements are variables and/or arrays specified in the statement, and a SAVE statement that specifies the named common block, and expands these statements into procedural subprograms. It is inserted into a subprogram.

第2図はSAVE文情報テーブル12の構成例を示す。FIG. 2 shows an example of the structure of the SAVE statement information table 12.

SAVE文情報テーブル12には、一つのSAVE文に
つき、そのSAVE文により指定された変数または/お
よび配列の個数110が登録されると共に、各変数等に
対応してその長さ120および名前130が登録される
In the SAVE statement information table 12, for each SAVE statement, the number 110 of variables and/or arrays specified by the SAVE statement is registered, as well as the length 120 and name 130 corresponding to each variable. be registered.

第3図はフォートラン言語で記述された展開前の原始プ
ログラム200及び展開後の原始プログラム210の一
例を示す。展開前の原始プログラム200には、CAL
L文240を含む主プログラム220と、SAVE文2
50を含むサブルーチン副プログラム230とが含まれ
ている。このような展開前の原始プログラム200がフ
ァイル2より第1図の手続き副プログラム展開機構1に
入力されると、主プログラム220が呼び出しプログラ
ム解析部10で処理され、サブルーチン副プログラム2
30が手続き副プログラム解析部20で処理される。こ
のとき、手続き副プログラム解析部20では、サブルー
チン副プログラム230のSAVE文250を除く他の
部分を展開した文270を生成すると共に、SAVE文
解析部21において、SAVE文250の内容から、こ
のSAVE文に措定された変数、配列の個数「2」。
FIG. 3 shows an example of a source program 200 before expansion and a source program 210 after expansion written in the Fortran language. The source program 200 before deployment includes CAL
Main program 220 including L statement 240 and SAVE statement 2
A subroutine subprogram 230 including 50 is included. When such an unexpanded source program 200 is input from the file 2 to the procedure subprogram expansion mechanism 1 shown in FIG.
30 is processed by the procedural subprogram analysis unit 20. At this time, the procedural subprogram analysis unit 20 generates a statement 270 that expands the other parts of the subroutine subprogram 230 except for the SAVE statement 250, and the SAVE statement analysis unit 21 generates this SAVE statement from the contents of the SAVE statement 250. The number of variables and arrays defined in the statement is "2".

各変数の長さrlJ、r3jおよび各変数、配列の名前
rAJ 、rBBBjを抽出し、第2図の如<SAVE
文情報テーブル12に登録する0次に、プログラム作成
部30による原始プログラム210の作成処理において
、主プログラム220のCALL文240の位置に手続
き副プログラム解析部20で生成された文270が挿入
される。また、COMMON文/SAVE文作成挿入部
31において、SAVE文情報テーブル12の登録内容
に従い、同一の共通ブロック名を持つCOMMON文と
SAVE文とから構成される文260,280が作成さ
れる。但し、文260は主プログラム220で使用され
ている名標と重複しないように変数名を変更して作成す
る。そして、COMMON文/SAVE文作成挿入部3
1は、上記の作成した文260を主プログラム220に
、文280をサブルーチン副プログラム230にそれぞ
れ挿入し、第3図に示す展開後の原始プログラム210
を得るものである。
Extract the lengths of each variable rlJ, r3j and the names of each variable and array rAJ, rBBBj, and save them as shown in Figure 2.
0 to be registered in the statement information table 12 Next, in the process of creating the source program 210 by the program creation unit 30, the statement 270 generated by the procedural subprogram analysis unit 20 is inserted at the position of the CALL statement 240 of the main program 220. . Further, the COMMON statement/SAVE statement creation/insertion unit 31 creates statements 260 and 280 consisting of a COMMON statement and a SAVE statement having the same common block name, according to the registered contents of the SAVE statement information table 12. However, the statement 260 is created by changing variable names so that they do not overlap with the names used in the main program 220. Then, COMMON statement/SAVE statement creation insertion section 3
1 inserts the statement 260 created above into the main program 220 and the statement 280 into the subroutine subprogram 230, resulting in the expanded source program 210 shown in FIG.
This is what you get.

このように、展開後の原始プログラム210においては
、主プログラム220に、サブルーチン副プログラム中
のSAVE文を無視した格好の文270が展開されると
共に、主プログラム220とサブルーチン副プログラム
230とにSAVE文250で指定されている変数、配
列を要素に持つ名前付き共通ブロックを宣言するCOM
MON文およびその名前付き共通ブロックを指定したS
AVE文(260,280)を挿入したので、他の箇所
からサブルーチン副プログラム230が呼び出される場
合があっても、実行結果を保証することが可能となる。
In this way, in the expanded source program 210, the main program 220 is expanded with a suitable statement 270 that ignores the SAVE statement in the subroutine subprogram, and the SAVE statement is expanded into the main program 220 and the subroutine subprogram 230. COM that declares a named common block whose elements are variables and arrays specified in 250.
S specifying the MON statement and its named common block
Since the AVE statements (260, 280) are inserted, even if the subroutine subprogram 230 is called from another location, the execution result can be guaranteed.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、本発明は、手続き副プログラム内
にSAVE文が含まれる場合、単にそのSAVE文を無
視した格好でその手続き副プログラムを展開するだけで
なく、そのSAVE文で指定されている変数、配列を要
素に持つ名前付き共通ブロックを宣言するCOMMON
文およびその名前付き共通ブロックを措定したSAVE
文を作成し、これらを手続き副プログラムが展開された
手続きプログラム並びに手続き副プログラムに挿入して
いるので、プログラムの実行結果も保証されたものとな
る。このように、本発明によれば、手続き副プログラム
中にSAVE文があっても、それを呼び出す手続きプロ
グラムに展開することが可能となり、実行時に手続き呼
び出しを行うことで発生するオーバーヘッドをなくすこ
とができ
As explained above, when a SAVE statement is included in a procedural subprogram, the present invention not only expands the procedural subprogram while ignoring the SAVE statement, but also expands the procedure subprogram specified by the SAVE statement. COMMON declares a named common block with variables and arrays as elements
SAVE assuming a statement and its named common block
Since the statements are created and inserted into the expanded procedure program and procedural subprogram, the execution results of the program are guaranteed. As described above, according to the present invention, even if there is a SAVE statement in a procedural subprogram, it can be expanded to a procedural program that calls it, and the overhead caused by calling a procedure during execution can be eliminated. Can be done

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例の構成図、 第2図はSAVE文情報テーブルの構成図および、 第3図は展開前後の原始プログラムの一例を示す図であ
る。 図において、 !・・・手続き副プログラム展開機構 2゜3・・・ファイル lO・・・呼び出しプログラム解析部 12・・・SAVE文情報テーブル 20・・・手続き副プログラム解析部 21・・・SAVE文解析部 30・・・プログラム作成部 31・COMMON文/SAVE文作成挿入部200・
・・展開前の原始プログラム 210・・・展開後の原始プログラム
FIG. 1 is a block diagram of an embodiment of the present invention, FIG. 2 is a block diagram of a SAVE statement information table, and FIG. 3 is a diagram showing an example of a source program before and after expansion. In the figure, ! ...Procedural subprogram expansion mechanism 2゜3...File lO...Call program analysis section 12...SAVE statement information table 20...Procedural subprogram analysis section 21...SAVE statement analysis section 30.・Program creation section 31・COMMON statement/SAVE statement creation and insertion section 200・
... Source program before expansion 210 ... Source program after expansion

Claims (1)

【特許請求の範囲】 フォートラン言語で記述された原始プログラム中の手続
き副プログラムを、該手続き副プログラムを呼び出す手
続きプログラムに展開する手続き副プログラム展開方式
において、手続き副プログラムを解析する解析部に設け
られ、前記手続き副プログラム内にSAVE文が存在す
るか否かを解析し、存在している場合にはSAVE文で
指定されている変数、配列に関する情報をSAVE文情
報テーブルに格納するSAVE文解析手段と、 手続き副プログラムが展開された手続きプログラムを含
む原始プログラムを作成するプログラム作成部に設けら
れ、前記SAVE文情報テーブルに基づき、前記手続き
副プログラムのSAVE文に指定された変数、配列を要
素に持つ名前付き共通ブロックを宣言するCOMMON
文およびその名前付き共通ブロックを指定したSAVE
文を作成し、前記手続き副プログラムが展開された手続
きプログラムおよび前記手続き副プログラムに挿入する
COMMON文/SAVE文作成挿入手段とを含むこと
を特徴とする手続き副プログラム展開方式。
[Claims] In a procedural subprogram expansion method that expands a procedural subprogram in a source program written in the Fortran language into a procedure program that calls the procedural subprogram, , a SAVE statement analysis means that analyzes whether or not a SAVE statement exists in the procedural subprogram, and if it does exist, stores information regarding variables and arrays specified in the SAVE statement in a SAVE statement information table; is provided in a program creation unit that creates a source program including a procedural program in which a procedural subprogram is expanded, and converts variables and arrays specified in the SAVE statement of the procedural subprogram into elements based on the SAVE statement information table. COMMON to declare a named common block with
SAVE with statement and its named common block
A procedural subprogram expansion method comprising: a procedure program in which the procedural subprogram is expanded, and a COMMON statement/SAVE statement creation/insertion unit that creates a statement and inserts the procedural subprogram into the expanded procedure program and the procedural subprogram.
JP63163661A 1988-06-30 1988-06-30 Procedure subprogram developing system Pending JPH0212528A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63163661A JPH0212528A (en) 1988-06-30 1988-06-30 Procedure subprogram developing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63163661A JPH0212528A (en) 1988-06-30 1988-06-30 Procedure subprogram developing system

Publications (1)

Publication Number Publication Date
JPH0212528A true JPH0212528A (en) 1990-01-17

Family

ID=15778182

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63163661A Pending JPH0212528A (en) 1988-06-30 1988-06-30 Procedure subprogram developing system

Country Status (1)

Country Link
JP (1) JPH0212528A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6850048B2 (en) 2003-05-02 2005-02-01 Potentia Semiconductor, Inc. Power supply controller

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6850048B2 (en) 2003-05-02 2005-02-01 Potentia Semiconductor, Inc. Power supply controller

Similar Documents

Publication Publication Date Title
JP2666847B2 (en) Heterogeneous language communication method
KR960035260A (en) Method and apparatus for indicating the location of an error detected in a software macro call
JPH0212528A (en) Procedure subprogram developing system
JPH0343833A (en) Procedure subprogram extension system
JPH02236732A (en) Source program generating system
JPH04344534A (en) Procedure sub-program developing system
JPH01205230A (en) Procedure sub-program developing system
JP3305767B2 (en) Sort processing method and compilation method
KR950015127A (en) CHILL Separate Compilation Method
JP3114884B2 (en) Fuzzy inference processing compilation system
JP3019874B2 (en) Program generation / synthesis apparatus and method
JPH04148336A (en) Fortran program grammar analyzing system
JP2860383B2 (en) Compiler unit
JPS63115236A (en) Object selecting system
JPH0736685A (en) Parts processor
JPH05150960A (en) Precompiler
JPH0635712A (en) Automatic in-line expansion processing system for procedure in fortran program
JPH08194624A (en) Executing form program preparing method
JPS63271636A (en) Macroprocessor for language
JPH04181325A (en) Translation processing system for source program
JPH02205930A (en) Interface check processing method
JPH09198246A (en) Method for analyzing function calling status
JPS61283929A (en) Copyright display protecting system
JPH06242986A (en) Debugging system using external line number
JPS62226334A (en) General purpose declared macro definition system