JP2807162B2 - Program translator - Google Patents

Program translator

Info

Publication number
JP2807162B2
JP2807162B2 JP5337141A JP33714193A JP2807162B2 JP 2807162 B2 JP2807162 B2 JP 2807162B2 JP 5337141 A JP5337141 A JP 5337141A JP 33714193 A JP33714193 A JP 33714193A JP 2807162 B2 JP2807162 B2 JP 2807162B2
Authority
JP
Japan
Prior art keywords
file
program
definition
variable
external
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
JP5337141A
Other languages
Japanese (ja)
Other versions
JPH07200309A (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.)
Denso Ten Ltd
Original Assignee
Denso Ten Ltd
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 Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP5337141A priority Critical patent/JP2807162B2/en
Publication of JPH07200309A publication Critical patent/JPH07200309A/en
Application granted granted Critical
Publication of JP2807162B2 publication Critical patent/JP2807162B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、ソースプログラムを複
数に分割して作成し、作成されたソースプログラムの翻
訳を行うプログラム翻訳装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program translating apparatus that divides a source program into a plurality of pieces, creates the program, and translates the created source program.

【0002】[0002]

【従来の技術】従来から、コンピュータプログラム作成
の際には、作成すべきプログラムを複数のモジュールに
分割して作成することが多い。複数のプログラム作成者
が分担して作業したり、プログラムの修正や点検を容易
にするためである。近年、広く用いられているプログラ
ム言語の1つであるC言語では、プログラムを分割して
作成することを支援するために、1つの関数中で使用す
る変数などは一般に局所的な自動変数として解釈され、
他の関数中で同一名称の変数があても、それぞれ独立し
て取扱われる。これらの自動変数は、たとえばスタック
領域にいわば動的に割当てられ、その変数を定義してい
る関数が呼出されているときにしか変数のストア内容で
あるデータは確定していない。関数の呼出しにかかわり
なく、データを常に保持するための変数は静的変数とも
呼ばれ、特定のメモリアドレスに割当てられる。これら
の静的変数の中でも、他のファイルから使用される変数
は、外部参照可能な変数として取扱われる。
2. Description of the Related Art Conventionally, when a computer program is created, a program to be created is often divided into a plurality of modules. This is because a plurality of program creators share the work and make it easy to modify and check the program. In recent years, in the C language, which is one of the widely used programming languages, variables used in one function are generally interpreted as local automatic variables in order to support the creation of divided programs. And
Even if there is a variable with the same name in another function, it is handled independently. These automatic variables are dynamically allocated, for example, in a so-called stack area, and the data that is the stored contents of the variables is determined only when the function that defines the variables is called. Regardless of the function call, a variable for always holding data is also called a static variable and is assigned to a specific memory address. Among these static variables, variables used from other files are treated as externally referable variables.

【0003】図6は、複数のファイル1,2,3,にソ
ースプログラムを分割し、それぞれのファイル1,2,
3中で外部参照可能な変数「ram1」,「ram
2」,「ram3」,「ram4」の少なくとも一部を
定義している場合を示す。なお各変数の型は、たとえば
整数型を表す「int」であるとする。各ファイル1〜
3にはこのような外部参照可能な変数の定義ばかりでは
なく、1または複数の関数定義なども含み得る。各ファ
イル1〜3をそれぞれ別個にコンパイルすると、文法的
なエラーなどが他になければコンパイル自体は成功し、
オブジェクトプログラムがそれぞれ得らる。全体として
1つのプログラムを作成するためには、それぞれのファ
イル1〜3から得られたオブジェクトプログラムをリン
クする必要がある。オブジェクトプログラムには外部定
義変数を参照するための変数名や相対アドレスなどの情
報も含まれる。図6に示す場合、たとえば「ram1」
および「ram2」はファイル1およびファイル2で重
複して定義されている。「ram3」および「ram
4」についても重複して定義されている。このためオブ
ジェクトプログラムをリンクして1つのプログラムにま
とめる際に多重定義のエラーになる。
FIG. 6 shows a case where a source program is divided into a plurality of files 1, 2, 3, and the respective files 1, 2, 2, and 3.
Variables "ram1" and "ram1"
2 ”,“ ram3 ”, and“ ram4 ”are defined. It is assumed that the type of each variable is, for example, "int" representing an integer type. Each file 1
3 may include not only the definition of such externally referable variables, but also one or more function definitions. If each of the files 1 to 3 is compiled separately, the compilation itself will succeed if there are no other grammatical errors, etc.
Obtain the object program respectively. In order to create one program as a whole, it is necessary to link object programs obtained from the respective files 1 to 3. The object program also includes information such as variable names and relative addresses for referring to externally defined variables. In the case shown in FIG. 6, for example, "ram1"
And “ram2” are defined redundantly in file 1 and file 2. "Ram3" and "ram
"4" is also defined redundantly. For this reason, when linking object programs into one program, an overload error occurs.

【0004】図7は、C言語に備えられている分割プロ
グラムを支援する機能であるヘッダファイルのインクル
ードのためのプリプロセッサ制御行を利用する例を示
す。ソースプログラムは、たとえば「main.c」、
「sub1.c」および「sub2.c」の3つのファ
イルに分割される場合を想定する。外部参照可能な変数
の多重定義を避けるために、変数は「ram.h」とい
うヘッダファイルにまとめられて宣言され定義される。
「main.c」ではこの「ram.h」を「#inc
lude」というプリプロセッサ制御行による命令で取
込む。他のファイルである「sub1.c」および「s
ub2.c」で同様に「ram.h」取込むと多重定義
となるので、外部定義ファイルである「ram_ex
t.h」を別に作成して取込むようにする。すなわち、
で示すようにRAM宣言が2箇所必要である。制御用
プログラムでは、直接機械語でプログラムを作成する部
分も必要となることがある。そのために、たとえば「i
nit.asm」などのアセンブラプログラムも必要と
なる。アセンブラプログラムは、アセンブラによって機
械語に翻訳される。C言語で作成されたプログラムと、
アセンブラ言語で作成されたプログラムとを結合するた
めには、C言語プログラム中で記述された変数をアセン
ブラプログラムからも参照可能とする必要がある。すな
わち、で示すようにアセンブラでも再宣言が必要であ
る。またで示すように、たとえば「init.as
m」中で使用される変数「a」について「パブリック
(public)」の宣言が必要となる。
FIG. 7 shows an example of using a preprocessor control line for including a header file, which is a function for supporting a divided program provided in the C language. The source program is, for example, “main.c”,
It is assumed that the file is divided into three files “sub1.c” and “sub2.c”. In order to avoid overloading variables that can be externally referenced, variables are declared and defined in a header file “ram.h”.
In “main.c”, this “ram.h” is replaced with “#inc
The instruction is fetched by the instruction of the preprocessor control line “lude”. Other files "sub1.c" and "s
ub2. Similarly, if "ram.h" is taken in with "c.c", it becomes overloaded, so the external definition file "ram_ex"
t. h ”is separately created and imported. That is,
As shown by, two RAM declarations are required. In some cases, the control program also requires a part for directly creating a program in a machine language. For this purpose, for example, "i
nit. An assembler program such as "asm" is also required. Assembler programs are translated into machine language by the assembler. A program written in C language,
In order to link a program written in the assembler language, it is necessary to make variables described in the C language program accessible from the assembler program. That is, redeclaration is necessary even in the assembler as shown by. As shown in the figure, for example, "init.as
It is necessary to declare the variable "a" used in "m" as "public".

【0005】[0005]

【発明が解決しようとする課題】前述のように、ヘッダ
ファイルのインクルード機能を用いて外部参照可能な変
数を定義する場合であっても、図7ので示すように、
ファイルによりインクルードするモジュールが異なる。
このため、図8に示すように、定義用のヘッダファイル
5と外部定義用の外部ヘッダファイル6との2つを作成
する必要がある。たとえば、「ram4」の型を「in
t」から文字型である「char」に変更するとき、外
部ヘッダファイル6についての修正を忘れるようなこと
が多い。このような修正のし忘れがあっても、分割コン
パイルにおいて各ソースファイルのコンパイルは成功す
る。リンクにおいても、見かけ上成功する場合もある。
しかしながら、変数「ram4」についての型が異なる
ので翻訳されたプログラムが誤動作しやすくなり、バグ
発生の要因となりやすい。また1つの変数についての修
正であっても複数のファイルを確実に修正しなければな
らないので、プログラム作成者にとっての負担が大き
い。
As described above, even when a variable that can be referred to externally is defined using the header file include function, as shown in FIG.
The included module differs depending on the file.
For this reason, as shown in FIG. 8, it is necessary to create two, a definition header file 5 and an external definition external header file 6. For example, if the type of “ram4” is “in
When changing from "t" to the character type "char", it is often the case that the modification of the external header file 6 is forgotten. Even if such a modification is forgotten, each source file is successfully compiled in the separate compilation. Links can also be apparently successful.
However, since the type of the variable “ram4” is different, the translated program is likely to malfunction, which is likely to cause a bug. In addition, even if a single variable is modified, a plurality of files must be surely modified, which imposes a heavy burden on a program creator.

【0006】本発明の目的は、1つのファイルの修正だ
けで変数定義についての必要な修正が可能で、プログラ
ム作成者の負担が少なく、信頼性の高いプログラムを作
成することができるプログラム翻訳装置を提供すること
である。
[0006] An object of the present invention is to provide a program translating apparatus which can make necessary modifications to variable definitions only by modifying one file, and can create a highly reliable program with less burden on a program creator. To provide.

【0007】[0007]

【課題を解決するための手段】本発明は、ソースプログ
ラムが記述される複数のプログラムファイル中で共通に
使用される変数を定義する定義用ファイル、または参照
する変数が他のプログラムファイル中で定義されること
を表す外部定義ファイルを、各プログラムファイルの翻
訳時に併せて読込むプログラム翻訳装置において、定義
用ファイルを読込み、変数を定義するための記述を、変
数を参照するための記述に変換して外部定義ファイルを
自動発生するファイル発生手段を含むことを特徴とする
プログラム翻訳装置である。
According to the present invention, there is provided a definition file for defining a variable commonly used in a plurality of program files in which a source program is described, or a variable to be referred to is defined in another program file. In a program translator that reads an external definition file indicating that a definition is to be made at the time of translation of each program file, it reads a definition file and converts a description for defining variables into a description for referring to variables. And a file generating means for automatically generating an external definition file.

【0008】[0008]

【作用】本発明に従えば、ソースプログラムは複数のプ
ログラムファイルで記述される。複数のプログラムファ
イル中で共通に使用される変数は定義用ファイルで定義
される。参照する変数が他のプログラムファイル中で定
義されることは外部定義ファイルによって定義される。
外部定義ファイルは、ファイル発生手段が定義用ファイ
ルを読込み、変数を定義するための記述を、変数を参照
するための記述に変換して自動生成する。プログラム翻
訳装置は、各プログラムファイルの翻訳時に併せて、定
義用ファイルまたは外部定義ファイルを読込む。外部定
義ファイルは定義用ファイルから自動生成されているの
で、定義用ファイルの内容に変更があっても自動的に修
正される。このためプログラム作成者の負担が小さく、
作成されるプログラムにも多重定義や型の不一致などに
よるバグの発生要因がなくなり、信頼性の高いプログラ
ムを得ることができる。
According to the present invention, a source program is described by a plurality of program files. Variables commonly used in multiple program files are defined in the definition file. The fact that the referenced variable is defined in another program file is defined by the external definition file.
The external definition file is automatically generated by the file generation means reading the definition file and converting the description for defining the variable into the description for referring to the variable. The program translator reads the definition file or the external definition file at the time of translating each program file. Since the external definition file is automatically generated from the definition file, any change in the contents of the definition file is automatically corrected. Therefore, the burden on the program creator is small,
The generated program does not have a factor of causing a bug due to overloading or mismatch of types, so that a highly reliable program can be obtained.

【0009】[0009]

【実施例】図1は、本発明の一実施例の簡略化した構成
を示す。ヘッダファイル10は、たとえば5つの変数
「ram1」〜「ram5」を整数型である「int」
として定義するヘッダファイルである。このヘッダファ
イル10の各行の先頭に「extern」を付加して、
外部ヘッダファイル11が作成される。ヘッダファイル
10は、1つのファイル20のプリプロセッサ制御行に
よる命令「#include ”ヘッダファイル”」に
従ってファイル20中へ取込まれる。外部ヘッダファイ
ル11は、複数のファイル21,22,23中のプリプ
ロセッサ制御行による命令「#include ”外部
ヘッダファイル”」に従って取込まれる。翻訳装置30
は、ヘッダファイル10から外部ヘッダファイル11を
自動発生させるファイル発生手段31と、ファイル20
〜23をそれぞれ読込み、インクルードを表すプリプロ
セッサ命令を実行するときにヘッダファイル10または
外部ヘッダファイル11を取込むコンパイラ手段32を
含む。コンパイラ手段32は、各ファイル20〜23を
それぞれ個別的にコンパイルし、オブジェクトファイル
40を生成する。各オブジェクトファイル40は、リン
カによって結合され、1つの全体的なプログラムとして
まとめられる。
FIG. 1 shows a simplified configuration of an embodiment of the present invention. The header file 10 stores, for example, five variables “ram1” to “ram5” as an integer “int”.
This is a header file defined as By adding “extern” to the beginning of each line of the header file 10,
An external header file 11 is created. The header file 10 is taken into the file 20 according to the instruction “#include“ header file ”” by the preprocessor control line of one file 20. The external header file 11 is taken in according to the instruction “#include“ external header file ”” by the preprocessor control line in the plurality of files 21, 22 and 23. Translation device 30
File generating means 31 for automatically generating the external header file 11 from the header file 10;
23, and a compiler means 32 for taking in the header file 10 or the external header file 11 when executing a preprocessor instruction representing an include. The compiler means 32 compiles each of the files 20 to 23 individually to generate an object file 40. Each object file 40 is linked by a linker and put together as one whole program.

【0010】リンカによってオブジェクトファイル40
を結合するリンクの際には、アセンブリ言語で記述され
たアセンブラのソースファイルをアセンブルしたオブジ
ェクトファイルも使用可能である。ファイル発生手段3
1は、ヘッダファイル10から外部ヘッダファイル11
を自動発生する際に、アセンブラのソースファイルにつ
いても外部参照用の記述を自動的に追加するようにする
こともできる。
[0010] The object file 40 by the linker
When linking is used, an object file obtained by assembling an assembler source file described in assembly language can also be used. File generation means 3
1 is the header file 10 to the external header file 11
Can be automatically added to the source file of the assembler when the file is automatically generated.

【0011】図2は、図1の実施例のファイル発生手段
31の動作を示す。ステップc1で動作を開始し、ステ
ップc2ではヘッダファイル10をオープンし、1行ず
つの読込みが可能な状態とする。次にステップc3でヘ
ッダファイル10に記述されているプログラムを1行ず
つ読込む。ステップc4では、その読込まれた行が変数
定義をしているか否かを判断する。変数定義をしている
ときには、ステップc5で行の先頭に「extern」
を付加し、外部ヘッダファイル11として別のファイル
に書込む。ステップc5が終了した後、あるいはステッ
プc4で変数定義していないと判断されるときには、ス
テップc6に移る。ステップc6では、読込んだプログ
ラムの行が最終行であるか否かを判断する。最終行でな
いと判断されるときにはステップc3に戻る。最終行と
判断されるときはステップc7で処理を終了する。この
ようなファイル発生手段31やコンパイラ手段32は、
ワークステーションやパーソナルコンピュータなどのコ
ンピュータ装置上で動作するソフトウェアとして実現さ
れる。
FIG. 2 shows the operation of the file generating means 31 of the embodiment shown in FIG. In step c1, the operation starts, and in step c2, the header file 10 is opened to make it possible to read line by line. Next, in step c3, the program described in the header file 10 is read line by line. In step c4, it is determined whether or not the read line defines a variable. If a variable is defined, "extern" is added to the beginning of the line in step c5.
Is added to the file and written into another file as the external header file 11. After step c5 is completed, or when it is determined in step c4 that no variable is defined, the process proceeds to step c6. At step c6, it is determined whether or not the read program line is the last line. When it is determined that it is not the last line, the process returns to step c3. If it is determined that the line is the last line, the process ends in step c7. Such file generation means 31 and compiler means 32
It is realized as software operating on a computer device such as a workstation or a personal computer.

【0012】図3は、本発明の他の実施例において達成
される翻訳の考え方を示す。本実施例では、変数定義用
のヘッダファイルをプログラムファイルと同等に取扱
う。この定義用ファイル「ram.c」から、で示す
ように、ファイル発生手段31は外部ヘッダファイルで
ある「ram_ext.h」を自動発生させる。コンパ
イラ手段32は、「ram.c」、「main.c」、
「sub1.c」および「sub2.c」をコンパイル
する。この際に、に示すように、アセンブラ言語のソ
ースファイル「init.asm」があれば、「ra
m.c」のコンパイル時に変数の再宣言を自動的に付加
する。またその宣言が外部定義であることを表すパブリ
ック宣言もで示すように付加されるので、「ini
t.asm」自体に記述することは不要である。ソース
プログラムが記述されたプログラムファイル「mai
n.c」、「sub1.c」および「sub2.c」で
は、それぞれ同一の外部ヘッダファイル「ram_ex
t.h」を取込むプリプロセッサ命令を記述すればよ
く、で示すようにインクルードするモジュールは同じ
となる。
FIG. 3 illustrates the concept of translation achieved in another embodiment of the present invention. In this embodiment, a header file for defining a variable is handled in the same manner as a program file. From the definition file “ram.c”, the file generating means 31 automatically generates an external header file “ram_ext.h”, as shown in FIG. The compiler means 32 outputs “ram.c”, “main.c”,
Compile “sub1.c” and “sub2.c”. At this time, if there is an assembler language source file "init.asm" as shown in FIG.
m. Automatically add variable redeclaration when compiling "c". In addition, a public declaration indicating that the declaration is an external definition is added as shown by "."
t. It is not necessary to describe it in "asm" itself. The program file “mai” in which the source program is described
n. c, “sub1.c” and “sub2.c” have the same external header file “ram_ex”, respectively.
t. It suffices to describe a preprocessor instruction that takes in "h", and the included module is the same as shown by.

【0013】図4および図5は、図3に示す「ram.
c」および「ram_ext.h」の例を示す。「ra
m.c」には、たとえばビット定義部50、構造体定義
部60、プリプロセッサ用定義部70および変数定義部
80が含まれる。ビット定義部50内には構造体の形式
でビットフィールドの定義内容51が記述される。構造
体定義部60には、構造体「struct」の1つの型
として「wordf」を宣言する構造体宣言61と、共
用体の1つの型「bytef」を宣言する共用体宣言6
2が含まれる。プリプロセッサ用定義部70には、他の
モジュールで定義される内容を参考用に表す参考用コメ
ント71と、実際に定数定義用のプリプロセッサ制御行
による命令「#define」で定義される定数「BY
TE」および「WORD」の定義内容を表す定数定義7
2とが含まれる。
FIGS. 4 and 5 show "ram.
c "and" ram_ext.h ". "Ra
m. "c" includes, for example, a bit definition unit 50, a structure definition unit 60, a preprocessor definition unit 70, and a variable definition unit 80. In the bit definition section 50, the definition contents 51 of the bit field are described in the form of a structure. The structure definition unit 60 includes a structure declaration 61 for declaring “wordf” as one type of the structure “struct” and a union declaration 6 for declaring one type “byteef” of the union.
2 is included. The preprocessor definition unit 70 includes a reference comment 71 indicating the contents defined by another module for reference, and a constant “BY” actually defined by an instruction “#define” by a preprocessor control line for defining a constant.
Constant definition 7 representing the definition contents of "TE" and "WORD"
2 is included.

【0014】変数定義部80には、符号なし文字型変数
を定義する変数定義81と、構造体を定義する構造体定
義82と、構造体宣言61で宣言された構造体を定義す
る構造体定義83と、プリプロセッサ用の定数定義84
と、符号なし文字型変数を定義する変数定義85,8
6,87と、プリプロセッサ用の定数定義88とが含ま
れる。
The variable definition section 80 includes a variable definition 81 for defining an unsigned character type variable, a structure definition 82 for defining a structure, and a structure definition for defining the structure declared in the structure declaration 61. 83 and constant definitions 84 for the preprocessor
And variable definitions 85 and 8 for defining unsigned character variables
6,87 and a constant definition 88 for the preprocessor.

【0015】本実施例のファイル発生手段は、「ra
m.c」に基づいて、図5に示す「ram_ext.
h」を自動生成する。「ram_ext.h」において
は、ビット定義部50、構造体定義部60およびプリプ
ロセッサ用定義部70はそのままコピーされる。図4の
変数定義部80は、図5では外部変数定義部90のよう
に変換される。外部変数定義部90内には、変数外部定
義91、構造体変数外部定義92,93、定数定義9
4、変数外部定義95,96,97、定数定義98が含
まれる。このうち定数定義94,98は、図4の変数定
義84,88と同一である。他の部分の先頭には、「e
xtern」が付加される。
[0015] The file generating means of this embodiment is "ra
m. c based on “ram_ext.c” shown in FIG.
h ”is automatically generated. In “ram_ext.h”, the bit definition unit 50, the structure definition unit 60, and the preprocessor definition unit 70 are copied as they are. The variable definition unit 80 in FIG. 4 is converted like the external variable definition unit 90 in FIG. In the external variable definition unit 90, a variable external definition 91, a structure variable external definition 92, 93, a constant definition 9
4. Variable external definitions 95, 96, 97 and constant definitions 98 are included. Among them, the constant definitions 94 and 98 are the same as the variable definitions 84 and 88 in FIG. At the beginning of the other part, "e
xtern "is added.

【0016】本実施例では、変数定義用のファイルを
「ram.c」として、プログラムファイルと同等に取
扱い、他のプログラムファイルでは外部定義ファイルの
みをインクルードするようにして、インクルードするモ
ジュールを同一にしている。しかしながら、たとえば
「main.c」で「ram.c」をインクルードする
ようにしてもよいことは勿論である。このときは、図1
の実施例と実質的に同一となる。インクルードするヘッ
ダファイルであることをより明確にするため、「ra
m.h」のようなファイル名に変更すれば、図1の実施
例になる。
In this embodiment, the variable definition file is treated as "ram.c", and is handled in the same manner as a program file. In other program files, only the external definition file is included, and the same module is included. ing. However, it goes without saying that, for example, “ram.c” may be included in “main.c”. At this time, FIG.
This is substantially the same as the embodiment. To make it clear that the header file is included, use "ra
m. If the file name is changed to "h", the embodiment shown in FIG. 1 is obtained.

【0017】また、そのような定義用ファイルを準備す
る段階も自動化することは可能である。複数のプログラ
ムファイルを作成したら、それぞれのプログラムファイ
ルから共通の外部変数を抽出して定義用ファイルを作成
し、自動的に外部ヘッダファイルも生成する。外部変数
を抜出した各プログラムファイルには、たとえば図2の
実施例と同様に外部ヘッダファイルをインクルードする
プリプロセッサ命令を付加する。このようにして一連の
ファイルを自動的に作成し、プログラム作成者の負担を
軽減し、バグの可能性を減少させて作成するプログラム
の信頼性を高めることができる。
Also, the step of preparing such a definition file can be automated. After creating a plurality of program files, a common external variable is extracted from each program file, a definition file is created, and an external header file is automatically generated. A preprocessor instruction for including an external header file is added to each program file from which the external variables are extracted, for example, as in the embodiment of FIG. In this way, a series of files are automatically created, the burden on the program creator can be reduced, the possibility of bugs can be reduced, and the reliability of the created program can be increased.

【0018】また、C言語によってプログラムを作成す
る場合について説明しているけれども、インクルード機
能を利用することができるアセンブラや他の高級言語の
プログラム翻訳装置であっても同様の効果を奏すること
は勿論である。
Although the description has been given of the case where a program is created in C language, the same effect can be obtained with an assembler or another high-level language program translator that can use the include function. It is.

【0019】[0019]

【発明の効果】以上のように本発明によれば、複数のプ
ログラムファイル中で共通に使用される変数の定義を変
更する際には、1つの定義用ファイル中の関連する記述
を変更するだけで、ファイル発生手段によって外部定義
ファイルも併せて変更されたものに修正される。したが
ってプログラム作成者の負担は小さくなり、変数の多重
定義や型の不一致などによるプログラム中のバグなどの
減少を図り、プログラムの信頼性を向上することができ
る。
As described above, according to the present invention, when changing the definition of a variable commonly used in a plurality of program files, only the related description in one definition file is changed. Then, the external definition file is also modified by the file generating means. Therefore, the burden on the program creator is reduced, and bugs and the like in the program due to overloading of variables and mismatch of types can be reduced, and the reliability of the program can be improved.

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

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

【図2】図1の実施例の動作を示すフローチャートであ
る。
FIG. 2 is a flowchart showing the operation of the embodiment of FIG.

【図3】本発明の他の実施例によって実現される処理の
考え方を示すブロック図である。
FIG. 3 is a block diagram showing a concept of processing realized by another embodiment of the present invention.

【図4】図3に示す「ram.c」の内容の一例を示す
プログラムリストである。
FIG. 4 is a program list showing an example of the contents of “ram.c” shown in FIG. 3;

【図5】図3の「ram_ext.h」の内容の一例を
示すプログラムリストである。
FIG. 5 is a program list showing an example of the contents of “ram_ext.h” in FIG. 3;

【図6】従来からの分割コンパイルにおける変数の定義
状態を示す簡略化したプログラムリストである。
FIG. 6 is a simplified program list showing the definition state of variables in a conventional split compilation.

【図7】従来のプログラム翻訳の考え方を示すブロック
図である。
FIG. 7 is a block diagram showing the concept of conventional program translation.

【図8】従来の考え方の問題点を示す簡略化したプログ
ラムリストである。
FIG. 8 is a simplified program list showing a problem of the conventional concept.

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

10 ヘッダファイル 11 外部ヘッダファイル 20〜23 ファイル 30 翻訳装置 31 ファイル発生手段 32 コンパイラ手段 80 変数定義部 81,85〜87 変数定義 90 外部変数定義部 91,95〜97 変数外部定義 DESCRIPTION OF SYMBOLS 10 Header file 11 External header file 20-23 File 30 Translator 31 File generating means 32 Compiler means 80 Variable definition part 81,85-87 Variable definition 90 External variable definition part 91,95-97 Variable external definition

───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.6,DB名) G06F 9/45 G06F 9/06 JICSTファイル(JOIS)──────────────────────────────────────────────────続 き Continued on the front page (58) Fields surveyed (Int.Cl. 6 , DB name) G06F 9/45 G06F 9/06 JICST file (JOIS)

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 ソースプログラムが記述される複数のプ
ログラムファイル中で共通に使用される変数を定義する
定義用ファイル、または参照する変数が他のプログラム
ファイル中で定義されることを表す外部定義ファイル
を、各プログラムファイルの翻訳時に併せて読込むプロ
グラム翻訳装置において、 定義用ファイルを読込み、変数を定義するための記述
を、変数を参照するための記述に変換して外部定義ファ
イルを自動発生するファイル発生手段を含むことを特徴
とするプログラム翻訳装置。
1. A definition file for defining variables commonly used in a plurality of program files in which a source program is described, or an external definition file indicating that variables to be referenced are defined in another program file Automatically reads the definition file, translates the description for defining variables into a description for referencing variables, and automatically generates an external definition file. A program translation device comprising file generation means.
JP5337141A 1993-12-28 1993-12-28 Program translator Expired - Fee Related JP2807162B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5337141A JP2807162B2 (en) 1993-12-28 1993-12-28 Program translator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5337141A JP2807162B2 (en) 1993-12-28 1993-12-28 Program translator

Publications (2)

Publication Number Publication Date
JPH07200309A JPH07200309A (en) 1995-08-04
JP2807162B2 true JP2807162B2 (en) 1998-10-08

Family

ID=18305835

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5337141A Expired - Fee Related JP2807162B2 (en) 1993-12-28 1993-12-28 Program translator

Country Status (1)

Country Link
JP (1) JP2807162B2 (en)

Also Published As

Publication number Publication date
JPH07200309A (en) 1995-08-04

Similar Documents

Publication Publication Date Title
US5680622A (en) System and methods for quickly detecting shareability of symbol and type information in header files
US6434742B1 (en) Symbol for automatically renaming symbols in files during the compiling of the files
US5408665A (en) System and methods for linking compiled code with extended dictionary support
US7380242B2 (en) Compiler and software product for compiling intermediate language bytecodes into Java bytecodes
USRE38104E1 (en) Method and apparatus for resolving data references in generated code
US5764989A (en) Interactive software development system
US6003095A (en) Apparatus and method for demand loading a dynamic link library
US6687896B1 (en) Computer system to compile non incremental computer source code to execute within incremental type computer system
US7823139B2 (en) Method and system for translating programming languages
US7743368B2 (en) Method and apparatus for providing class hierarchy information for function devirtualization
US20030088860A1 (en) Compiler annotation for binary translation tools
US8177122B2 (en) Providing diagnostic information on the processing of variables in source code
US8869126B2 (en) Method and apparatus enabling multi threaded program execution for a Cobol program including OpenMP directives by utilizing a two-stage compilation process
US20110093837A1 (en) Method and apparatus for enabling parallel processing during execution of a cobol source program using two-stage compilation
WO1997043711A1 (en) Incremental byte code compilation system
AU2892200A (en) Automatic stub/adapter generator
KR19980080502A (en) System and method for optimizing template object files
US8881123B2 (en) Enabling symbol resolution of private symbols in legacy programs and optimizing access to the private symbols
JPH11110194A (en) Connection method to external library function and recording medium in which the connection method is recorded and programmed
US8930925B2 (en) Method for enabling compilation of a Cobol source program utilizing a two-stage compilation process, the Cobol source program including a mix of Cobol, C++ or JAVA statements, and optional OpenMP directives
US7458071B2 (en) Compilation method, compiler apparatus and compiler
EP0740250A2 (en) Apparatus for dynamically reading and writing multiple object code formats through use of objective code readers and writers
US5535392A (en) Using hint generation to cause portions of object files to remain the same
JP5506936B2 (en) Object level compatibility and class resizing using semantic values
JP2807162B2 (en) Program translator

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19980707

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090724

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090724

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100724

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100724

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110724

Year of fee payment: 13

LAPS Cancellation because of no payment of annual fees