JP2016076080A - Source code analyzing apparatus, source code analyzing method, and program - Google Patents
Source code analyzing apparatus, source code analyzing method, and program Download PDFInfo
- Publication number
- JP2016076080A JP2016076080A JP2014205926A JP2014205926A JP2016076080A JP 2016076080 A JP2016076080 A JP 2016076080A JP 2014205926 A JP2014205926 A JP 2014205926A JP 2014205926 A JP2014205926 A JP 2014205926A JP 2016076080 A JP2016076080 A JP 2016076080A
- Authority
- JP
- Japan
- Prior art keywords
- block
- variable
- source code
- blocks
- configuration diagram
- 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
Links
Images
Abstract
Description
本発明は、プログラムのソースコードを解析するソースコード解析装置、ソースコード解析方法、及びプログラムに関する。 The present invention relates to a source code analyzing apparatus, a source code analyzing method, and a program for analyzing a source code of a program.
ソースコードを解析して、プログラムの構造を把握する技術が知られている。例えば、特許文献1には、ソースコードを解析して、予約語をノードとする抽象構造木データを作成することについて記載されている。
A technique for analyzing the source code and grasping the structure of the program is known. For example,
ソフトウェアの開発において、ソースコードは頻繁に変更される場合がある。ソースコードが変更された場合、ユーザは、ソースコードを目視で確認して記載されている処理を辿り、この変更に伴って変更する必要がある他の部分(影響範囲)を特定する必要がある。 In software development, the source code may change frequently. When the source code is changed, the user needs to visually check the source code and follow the described process, and specify other parts (influence ranges) that need to be changed in accordance with this change. .
特許文献1に記載の技術では、抽象構造木データからプログラムの構造は把握できるものの、ソースコードの変更による影響範囲を知るには不十分である。
With the technology described in
本発明は上記実情に鑑みてなされたものであり、ソースコードの変更による影響範囲を知ることができる、ソースコード解析装置等を提供することを目的とする。 The present invention has been made in view of the above circumstances, and an object thereof is to provide a source code analysis apparatus and the like that can know the range of influence due to a change in source code.
上記目的を達成するため、本発明のソースコード解析装置は、
予め定められた識別子に基づいて、プログラムのソースコードを構成するブロックを特定する構造解析手段と、
前記特定されたブロックごとに、前記ブロックに含まれる変数であって値が変更される変更変数と値が参照される参照変数とを判別する変数判別手段と、
ブロック間で共通の変数を含み、当該変数が一方のブロックで変更変数であり、他方のブロックで参照変数である場合に、前記ブロック間が依存関係にあると判別するブロック関係判別手段と、
を備える。
In order to achieve the above object, the source code analyzing apparatus of the present invention is
Based on a predetermined identifier, structure analysis means for identifying blocks constituting the source code of the program,
Variable discriminating means for discriminating, for each identified block, a change variable that is a variable included in the block and whose value is changed, and a reference variable whose value is referred to;
A block relationship determining unit that includes a common variable between blocks, the variable is a change variable in one block, and a reference variable in the other block;
Is provided.
本発明によれば、プログラムのソースコードからブロックが特定され、ブロック間の依存関係が判別される。従って、ソースコードの変更による影響範囲を知ることが可能となる。 According to the present invention, blocks are specified from the source code of the program, and the dependency relationship between the blocks is determined. Therefore, it is possible to know the range of influence due to the change of the source code.
以下、本発明の実施形態について、図面を参照しながら詳細に説明する。なお、図中同一または相当部分には同一符号を付す。また、特に言及が無い場合、例示するプログラムのソースコードは、C言語で記載されているものとする。また、例示するソースコードには、説明を容易にするため左側に行番号を付す。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In the drawings, the same or corresponding parts are denoted by the same reference numerals. Unless otherwise specified, the source code of the exemplified program is assumed to be written in C language. Further, in the illustrated source code, a line number is given on the left side for easy explanation.
本発明の実施形態に係るソースコード解析装置1は、プログラムのソースコードの構成を解析して、解析結果をブロック構成図として表示する装置である。ソースコード解析装置1は、図1に示すように、通信部11と、操作部12と、表示部13と、記憶部14と、入出力I/F部15と、制御部16と、を備える。各部はバス17を介して互いに接続されている。
A source
通信部11は、通信インタフェース等を備え、通信ネットワーク2を介して、ネットワーク2上の図示せぬ情報処理装置等と通信する。例えば、通信部11は、解析するソースコードを、これら通信ネットワーク2上の情報処理装置から受信してもよい。
The
操作部12は、ソースコード解析装置1に様々な情報を入力するために使用するものであり、キーボード等の入力装置を備える。例えば、ユーザは、操作部12を操作して、後述するブロック構成図の作成を指示する。
The
表示部13は、液晶ディスプレイ等の表示装置を備え、ブロック構成図や各種の画面等を表示する。
The
記憶部14は、ハードディスクドライブ等の補助記憶装置を備え、制御プログラムや様々なデータを記憶する。例えば、記憶部14には、解析するソースコード141や、後述するブロック構成データ142やブロック値データ143が記憶される。
The
入出力I/F部15は、入出力機器3を接続するためのインタフェースである。例えば、入出力I/F部15を介して、解析するソースコード141をCD−ROMドライブ等の入出力機器3から取り込んでもよい。
The input / output I /
制御部16は、データの演算処理を行うと共に、バス17を介して通信部11、操作部12、表示部13、記憶部14、入出力I/F部15を制御するものであり、CPU(Central Processing Unit)16a、ROM(Read Only Memory)16b、RAM(Random Access Memory)16c等を備える。制御部16における演算処理及び制御処理は、具体的には、CPU16aが、RAM16cを作業領域として使用して各種データを一時的に記憶させながら、ROM16bに記憶されている制御プログラムを実行することにより行われる。
The
ソースコード解析装置1は、機能的には、図2に示すように、構造解析部101と、変数判別部102と、ブロック指定部103と、ブロック関係判別部104と、構成図作成部105と、構成図表示部106と、を備える。なお、これらの各部は、図1に示した制御部16が、同じく図1に示した通信部11、操作部12、表示部13、記憶部14、又は入出力I/F部15を制御することにより実現される。
As shown in FIG. 2, the source
構造解析部101は、解析対象とするプログラムのソースコード141から、波括弧({})でくくられる部分を1つの処理の単位であるブロックとして特定する。また、構造解析部101は、特定した各ブロックに、識別用のID(ブロックID)を付す。また、構造解析部101は、特定したブロックの種類や、ブロック間の呼出関係や包含関係等の階層構造等を解析し、解析結果をブロック構成データ142として記録する。
The
なお、ブロックの種類は、例えば、関数の処理について記載されているブロック(関数ブロック)、IF文やSWITCH文等の分岐処理について記載されているブロック(分岐処理ブロック)、等がある。 The types of blocks include, for example, blocks describing function processing (function blocks), blocks describing branch processing such as IF statements and SWITCH statements (branch processing blocks), and the like.
なお、ブロック間の呼出関係は、あるブロックから別の関数ブロックを呼び出しているブロック間の関係を意味する。また、ブロック間の包含関係は、あるブロック内に、別のブロックが含まれているブロック間の関係を意味する。 In addition, the calling relationship between blocks means the relationship between the blocks which are calling another function block from a certain block. In addition, the inclusion relationship between blocks means a relationship between blocks in which another block is included in a certain block.
変数判別部102は、構造解析部101が特定したブロック毎に、変更変数と参照変数とを判別し、判別結果をブロック値データ143として記録する。ここで、変更変数は、ブロックに含まれていて、このブロックでの処理により値が変更される変数である。また、参照変数は、ブロックに含まれていて、このブロックでの処理により値が参照される変数である。
The
例えば、変数判別部102は、ソースコード141の構文を解析して、関数ブロックの引数として用いられている変数、分岐処理ブロックの条件式で用いられている変数、及びブロックに記載されている代入式の右辺で用いられている変数を参照変数と判別する。
For example, the
また、例えば、変数判別部102は、ソースコード141の構文を解析して、関数ブロックの戻り値として用いられている変数、及びブロックに記載されている代入式の左辺で用いられている変数を変更変数と判別する。
In addition, for example, the
ブロック指定部103は、ブロック構成図を表示するブロックの指定をユーザから受け付ける。
The
ブロック関係判別部104は、ブロック構成データ142を参照して、ブロック指定部103が指定を受け付けたブロックを構成する下位のブロックを判別する。そして、ブロック関係判別部104は、判別した下位の各ブロックにおいて、一方のブロックのソースコード141の変更が他方のブロックへ影響を及ぼすブロック間の依存関係を判別する。具体的には、ブロック関係判別部104は、ブロック間で共通の変数を含み、この変数が一方のブロックで変更変数であり、他方のブロックで参照変数である場合に、このブロック間は、一方のブロックが他方のブロックに依存する依存関係にあると判別する。
The block
構成図作成部105は、ブロック関係判別部104の判別結果に基づいて、ブロック指定部103が受け付けたブロックがどのような下位のブロックから構成されているか、及びそのブロック間の依存関係を表すブロック構成図を作成する。なお、構成図作成部105が作成するブロック構成図は、画像データ等のデータである。
Based on the determination result of the block
ここで、構成図作成部105によって作成されるブロック構成図の例を図3に示す。なお、このブロック構成図はブロックXの構成を表し、各ブロックは、矩形の図形で表されている。この図から、ブロックXは、下位のブロックA、B、C、Dを含むことがわかる。
Here, an example of a block configuration diagram created by the configuration
また、この図において、ブロックAとブロックBとは矢印線αで結ばれている。このことは、ブロックAで変数αの値が変更され、ブロックBで参照されることを示す。即ち、ブロックAのソースコード141の変更はブロックBへ影響を及ぼし、ブロックA、B間は依存関係にあることがわかる。
In this figure, the block A and the block B are connected by an arrow line α. This indicates that the value of the variable α is changed in the block A and is referenced in the block B. That is, it can be understood that the change of the
また、この図において、ブロックAとブロックCは矢印線βで結ばれている。このことは、ブロックAで変数βの値が変更され、ブロックCで参照されることを示す。即ち、ブロックAのソースコード141の変更はブロックCへ影響を及ぼし、ブロックA、C間は依存関係にあることがわかる。
In this figure, block A and block C are connected by an arrow line β. This indicates that the value of the variable β is changed in the block A and is referenced in the block C. That is, it can be seen that the change of the
一方、この図において、ブロックDは、他のブロックA、B、Cと矢印線で結ばれていない。そのため、ブロックDは、ブロックA、B、Cの変更による影響を受けない関係(非依存関係)であることがわかる。 On the other hand, in this figure, the block D is not connected to the other blocks A, B, and C by arrow lines. Therefore, it can be seen that the block D is a relationship (independent relationship) that is not affected by the change of the blocks A, B, and C.
図2に戻り、構成図表示部106は、構成図作成部105が作成したブロック構成図を表示する。
Returning to FIG. 2, the configuration
(ブロック構成表示処理)
続いて、ソースコード解析装置1の動作について、図4のフローチャートを用いて説明する。ユーザは、ソースコード解析装置1の操作部12を操作して対象のソースコード141を指定し、ブロック構成図の作成を指示する。この指示に応答して、ソースコード解析装置1は、指定されたソースコード141を対象にしたブロック構成表示処理を開始する。なお、ユーザは、複数のソースコード141を指定してもよい。
(Block configuration display processing)
Next, the operation of the source
まず、ソースコード解析装置1の構造解析部101は、解析対象のソースコード141から、特定の識別子に基づいて、ブロックを抽出する(ステップS10)。また、この際、構造解析部101は、抽出した各ブロックに識別用のブロックIDを付与する。
First, the
続いて、構造解析部101は、抽出したブロックの階層構造を解析し、ブロック構成データ142として記録する(ステップS20)。
Subsequently, the
続いて、変数判別部102は、抽出したブロック毎に、ブロックに含まれる各変数が参照変数と変更変数との何れかであるかを判別し、ブロック値データ143として記録する(ステップS30)。
Subsequently, the variable determining
続いて、ブロック指定部103は、ブロック選択用の画面を表示する等して、ステップS10で抽出したブロックの中から構成を表示したいブロックの指定をユーザから受け付ける(ステップS40)。なお、以下の説明では、ステップS40で受け付けたブロックを指定ブロックとも表記する。
Subsequently, the
続いて、ブロック関係判別部104は、ブロック構成データ142が示すブロック間の階層構造から、指定ブロックに含まれる下位のブロックを判別する(ステップS50)。
Subsequently, the block
続いて、ブロック関係判別部104は、ブロック値データ143を参照して、ステップS50で判別した各ブロックにおける、ブロック間の依存関係を判別する(ステップS60)。例えば、ブロック値データ143から、ブロックAで変数aの値が変更され、ブロックBで変数aの値が参照されることが分かった場合、ブロック関係判別部104は、ブロックAの変更はブロックBに影響を与えるため、ブロックA、B間は依存関係にあると判別する。
Subsequently, the block
続いて、構成図作成部105は、ステップS50の結果に基づいて、指定ブロックがどのようなブロックから構成されているかを表すとともに、ステップS60で判別したブロック間の依存関係も表すブロック構成図を作成する(ステップS70)。例えば、ステップS50、S60の結果から、指定ブロックに含まれるブロックはブロックA、Bであり、ブロックAで変数aの値が変更され、ブロックBで変数aの値が参照される依存関係にあることが分かった場合を考える。この場合、構成図作成部105は、ブロック構成図として、ブロックA、Bに対応する図形を横に並べ、ブロックAからブロックBに向かう変数aが付された矢印線で両図形を結んだブロック構成図を作成する。
Subsequently, the configuration
続いて、構成図表示部106は、作成したブロック構成図を表示する(ステップS80)。以上でブロック構成表示処理は終了する。
Subsequently, the configuration
(具体例)
続いて、図5に示すソースコード141を対象にブロック構成表示処理を行った場合の具体例について説明する。
(Concrete example)
Next, a specific example when the block configuration display process is performed on the
この場合、ステップS10の処理により、図6の破線で示すように、ソースコード141から波括弧({})でくくられている9つのブロックが抽出される。なお、各ブロックには、B1、B11、B111、B112、B113、B12、B121、B122、B123のブロックIDが付されたものとする。また、以下の説明では、ブロックIDがBnのブロックをブロックBnとも表記する。
In this case, nine blocks enclosed in curly brackets ({}) are extracted from the
なお、構造解析部101は、分岐処理の条件式部分と処理部分とのように、同じ波括弧({})でくくられていない部分であっても、同じブロックとして抽出するものとする。例えば、図6に示すソースコード141の8行目のIF文の条件式部分「if (int a2 > 0)」は、直後の8〜10行目に記載された処理部分と同じ波括弧({})でくくられていないが、同じブロックB111として抽出されている。
Note that the
続いて、ブロックが抽出された後、ステップS20の処理により、ブロックの階層構造が解析され、図7に示すブロック構成データ142が作成される。
Subsequently, after the blocks are extracted, the block
なお、このブロック構成データ142は、XML(Extensible Markup Language)で記載されており、各ブロックに「Block」タグが付与されることにより、ブロック間の階層構造が記録される。なお、「Block」タグの要素「id」はこのブロックのブロックIDを示す。また、要素「file」は、このブロックが記載されているソースファイルのファイル名を示し、要素「line」は、このブロックが記載されているソースファイルの行数を示す。また、要素「type」は、このブロックの種類を示す。
The
続いて、ステップS30の処理により、ブロック毎に、参照変数、変更変数が判別されて、図8、9に示すようなブロック値データ143が作成される。なお、このブロック値データ143は、XMLで作成されており、参照変数には「UsedValue」タグ、変更変数には「ChangedValue」タグが付される。
Subsequently, by the process of step S30, the reference variable and the change variable are determined for each block, and block
例えば、図6に示すソースコード141の8〜10行目に記載されているブロックB111では、8行目のIF文の条件式で変数a2の値が参照されている。そのため、a2は参照変数と判別される。また、9行目では、変数a1の値が10に変更(代入)されている。そのため、変更変数はa1と判別される。そして、これらの判別結果を表すブロック値データ143が、図8(A)に示すように作成される。
For example, in the block B111 described in the 8th to 10th lines of the
同様に、図6に示すブロックB112、B113からは、図8(B)、(C)に示すブロック値データ143が作成される。また、図8(D)に示すように、ブロックB11のブロック値データ143は、下位のブロックB111〜B113の参照変数と変更変数とを全て含むように作成される。
Similarly, block
同様に、ブロックB121〜B123、B12からは、それぞれ、図9(A)〜(D)に示すブロック値データ143が作成される。なお、図6に示すブロックB122の26行目では、変数b1の値が参照されるとともに代入(変更)されている。そのため、図9(B)に示すブロック値データ143では、変数b1は参照変数及び変更変数として記録されている。
Similarly, block
続いて、ステップS40の処理で、ブロックB11が指定された場合を考える。 Next, consider a case where the block B11 is designated in the process of step S40.
この場合、図7に示すブロック構成データ142から、指定されたブロックB11に含まれる下位のブロックB111、B112、113が特定される(ステップS50)。また、図8(A)に示すブロックB111のブロック値データ143と図8(B)に示すブロックB112のブロック値データ143とから、ブロックB111とブロックB112との間には、共通の変数a1があり、ブロックB111では変更変数、ブロックB112では参照変数であるため、このブロック間は依存関係にあると判別される(ステップS60)。そして、図10に示すようなブロックB11のブロック構成図が作成されて、表示される(ステップS70、S80)。
In this case, lower block B111, B112, 113 included in the designated block B11 is specified from the
ユーザは、このブロック構成図から、ブロックB11は、3つのブロックB111、B112、B113から構成されていることがわかる。また、ブロックB111とブロックB112とは横に並べて配置され、矢印線a1で結ばれている。そのため、ブロックB111で値が変更された変数aがブロックB112で参照されるため、ブロックB111を変更するとブロックB112に影響することがわかる。また、ブロックB113は、ブロックB111、B112と矢印線で結ばれていない。そのため、ブロックB113は、ブロックB111、B112の変更による影響は受けないことがわかる。 From this block diagram, the user can see that the block B11 is composed of three blocks B111, B112, and B113. The block B111 and the block B112 are arranged side by side and connected by an arrow line a1. Therefore, since the variable a whose value is changed in the block B111 is referred to in the block B112, it can be seen that changing the block B111 affects the block B112. The block B113 is not connected to the blocks B111 and B112 by an arrow line. Therefore, it can be seen that the block B113 is not affected by the change of the blocks B111 and B112.
続いて、ステップS40の処理で、ブロックB12が指定された場合を考える。この場合、同様にブロックB12の下位のブロック、およびブロック間の依存関係が特定され(ステップS50、S60)、図11に示すようなブロックB12のブロック構成図が作成されて、表示される(ステップS70、S80)。 Next, consider a case where block B12 is designated in the process of step S40. In this case, the lower block of the block B12 and the dependency relationship between the blocks are similarly specified (steps S50 and S60), and a block configuration diagram of the block B12 as shown in FIG. 11 is created and displayed (steps). S70, S80).
ユーザは、この図から、ブロックB12は、3つのブロックB121、B122、B123から構成されていることがわかる。また、ブロックB121、B122、B123は横に並べて配置され、ブロックB121、B122間、及びブロックB122、B123間は、同じ矢印線b1で結ばれている。そのため、ブロックB121で値が変更された変数b1がブロックB122で参照及び変更され、さらにブロックB123で参照されることがわかる。そのため、ブロックB121の変更はブロックB122に影響し、さらに、ブロックB122の変更はブロックB123に影響することがわかる。 From this figure, the user can see that the block B12 is composed of three blocks B121, B122, and B123. The blocks B121, B122, and B123 are arranged side by side, and the blocks B121 and B122 and the blocks B122 and B123 are connected by the same arrow line b1. Therefore, it can be seen that the variable b1 whose value has been changed in the block B121 is referred to and changed in the block B122 and further referred to in the block B123. Therefore, it can be seen that the change of the block B121 affects the block B122, and further, the change of the block B122 affects the block B123.
このように、本発明によれば、ソースコードからブロックが特定され、ブロック毎に値が変更される変更変数と値が参照される参照変数とが判別される。そして、ブロック間で共通の変数を含み、この変数が一方のブロックで変更変数であり、他方のブロックで参照変数である場合に、このブロック間は依存関係にあると判別される。そのため、判別された依存関係から、ブロックのソースコードの変更によって影響を及ぼす他のブロックがわかるため、ユーザは、ソースコードの変更による影響範囲を容易に知ることが可能となる。 Thus, according to the present invention, a block is specified from the source code, and a change variable whose value is changed for each block and a reference variable whose value is referred to are determined. Then, when a variable common to the blocks is included and this variable is a change variable in one block and a reference variable in the other block, it is determined that there is a dependency between the blocks. For this reason, since other blocks that are affected by the change of the source code of the block can be known from the determined dependency relationship, the user can easily know the range of influence by the change of the source code.
また、本発明によれば、判別された依存関係を表すブロック構成図が作成されて表示される。より具体的には、本発明では、依存関係にあるブロック間が、共通に参照、変更される変数名が付された矢印線で結ばれた形のブロック構成図が作成されて表示される。従って、ユーザは、作成されたブロック構成図から、ブロックの変更による影響範囲をより容易に知ることが可能となる。 Further, according to the present invention, a block configuration diagram representing the determined dependency relationship is created and displayed. More specifically, in the present invention, a block configuration diagram is created and displayed in a form in which the blocks in the dependency relationship are connected by an arrow line with a variable name commonly referred to and changed. Therefore, the user can more easily know the influence range due to the block change from the created block configuration diagram.
また、本発明によれば、ブロック間の階層構造が特定されて、ユーザが指定した特定のブロック(指定ブロック)に含まれる下位のブロックの構成と、ブロック間の依存関係と、を表すブロック構成図が作成される。従って、ユーザは、多くのブロックから構成される大規模なソースプログラムであっても、構成を知りたいブロックのみを指定して、その構成や依存関係を容易に知ることが可能となる。 Further, according to the present invention, the hierarchical structure between the blocks is specified, and the block configuration representing the configuration of the lower blocks included in the specific block (specified block) specified by the user and the dependency relationship between the blocks A diagram is created. Therefore, even for a large-scale source program composed of a large number of blocks, the user can specify only the block whose configuration is to be known and easily know its configuration and dependency.
なお、本発明は、上記実施形態に限定されず、本発明の要旨を逸脱しない部分での種々の修正は勿論可能である。 In addition, this invention is not limited to the said embodiment, Of course, the various correction in the part which does not deviate from the summary of this invention is possible.
例えば、図12に示すように、操作部12を介して、表示したブロック構成図からブロックの指定を受け付けた際に、ブロック構成データ142を参照して対応するソースコードの部分を特定して表示してもよい。この例では、ブロックB111が指定された場合に、図7に示すブロック構成データ142に示すブロックB111の「Block」タグの要素「line」の値から、対応するソースコードの部分(図6に示すソースコードの8〜10行目)が特定されて、吹き出しで表示されている。
For example, as shown in FIG. 12, when a block designation is received from the displayed block configuration diagram via the
また、上記実施形態では、XMLで記載されているブロック構成データ142やブロック値データ143の例を示したが、他のマークアップ言語や、他のフォーマットでブロック構成データ142やブロック値データ143を作成してもよい。例えば、表形式のテーブル等でブロック構成データ142やブロック値データ143を作成してもよい。
In the above embodiment, examples of the
また、上記実施形態では、図10に示すように、ブロック構成図のブロックを表す図形にブロックIDを付して表示した。しかしながら、ブロックID以外の情報を表示してもよい。例えば、そのブロックが示す処理名や関数名や対応するソースコードの一部やコメント文等を表示してもよい。 Moreover, in the said embodiment, as shown in FIG. 10, the block ID was attached | subjected and displayed on the figure showing the block of a block block diagram. However, information other than the block ID may be displayed. For example, the processing name or function name indicated by the block, a part of the corresponding source code, a comment sentence, or the like may be displayed.
また、上記実施形態では、ブロック構成表示処理において、ブロック指定部103が指定を受け付けたブロック(指定ブロック)の構成図を作成したが、ソースコードから抽出した全てのブロックのブロック構成図を作成したり、予め設定されているブロックの構成図を作成してもよい。なお、この場合、ブロック指定部103を設けなくともよい。
In the above embodiment, the block configuration display process creates a block diagram of the block (designated block) for which the
また、上記実施形態では、ブロック構成表示処理において、構造解析部101がブロックの階層構造を特定し、ブロック構成図で指定ブロックの構成(指定ブロックに含まれる下位のブロック)を示した。しかしながら、構造解析部101がソースコードからのブロックの特定のみを行い、特定したブロック間の依存関係を示すブロック構成図を作成してもよい。
Further, in the above embodiment, in the block configuration display process, the
また、上記実施形態で示したブロック構成図は一例にすぎず、ソースコードのブロック構成を表示できるあらゆる種類のブロック構成図の作成に本発明は適用可能である。例えば、テキスト形式でブロックの構造やブロック間の依存関係を表示する図等も、本発明のブロック構成図に含まれる。 The block configuration diagram shown in the above embodiment is merely an example, and the present invention can be applied to the creation of all types of block configuration diagrams that can display the block configuration of the source code. For example, a diagram showing a block structure and a dependency relationship between blocks in a text format is also included in the block configuration diagram of the present invention.
また、上記実施形態では、C言語で記載されたソースコードを例に説明したが、JAVA(登録商標)やC++等の他の言語で記載されたソースコードにも、本発明は適用可能である。なお、その場合、各言語の書式に合った規則で、ソースコードからブロックを抽出すればよい。 In the above embodiment, the source code written in C language has been described as an example. However, the present invention can also be applied to source code written in other languages such as JAVA (registered trademark) and C ++. . In that case, a block may be extracted from the source code according to a rule suitable for the format of each language.
また、例えば、本実施形態に係るソースコード解析装置1の動作を規定する動作プログラムを既存のパーソナルコンピュータや情報端末機器等に適用することで、当該パーソナルコンピュータ等を本発明に係るソースコード解析装置1として機能させることも可能である。
In addition, for example, by applying an operation program that defines the operation of the source
また、このようなプログラムの配布方法は任意であり、例えば、CD−ROM(Compact Disk Read-Only Memory)、DVD(Digital Versatile Disk)、MO(Magneto Optical Disk)、メモリカードなどのコンピュータで読み取り可能な記録媒体に格納して配布してもよいし、インターネットなどの通信ネットワークを介して配布してもよい。 Further, such a program distribution method is arbitrary, and can be read by a computer such as a CD-ROM (Compact Disk Read-Only Memory), a DVD (Digital Versatile Disk), an MO (Magneto Optical Disk), or a memory card. It may be distributed by being stored in a recording medium, or distributed via a communication network such as the Internet.
1 ソースコード解析装置、2 通信ネットワーク、3 入出力機器、11 通信部、12 操作部、13 表示部、14 記憶部、15 入出力I/F部、16 制御部、16a CPU、16b ROM、16c RAM、17 バス、101 構造解析部、102 変数判別部、103 ブロック指定部、104 ブロック関係判別部、105 構成図作成部、106 構成図表示部、141 ソースコード、142 ブロック構成データ、143 ブロック値データ 1 source code analysis device, 2 communication network, 3 input / output device, 11 communication unit, 12 operation unit, 13 display unit, 14 storage unit, 15 input / output I / F unit, 16 control unit, 16a CPU, 16b ROM, 16c RAM, 17 buses, 101 structure analysis unit, 102 variable discrimination unit, 103 block designation unit, 104 block relation discrimination unit, 105 configuration diagram creation unit, 106 configuration diagram display unit, 141 source code, 142 block configuration data, 143 block value data
Claims (10)
前記特定されたブロックごとに、前記ブロックに含まれる変数であって値が変更される変更変数と値が参照される参照変数とを判別する変数判別手段と、
ブロック間で共通の変数を含み、当該変数が一方のブロックで変更変数であり、他方のブロックで参照変数である場合に、前記ブロック間が依存関係にあると判別するブロック関係判別手段と、
を備えるソースコード解析装置。 Based on a predetermined identifier, structure analysis means for identifying blocks constituting the source code of the program,
Variable discriminating means for discriminating, for each identified block, a change variable that is a variable included in the block and whose value is changed, and a reference variable whose value is referred to;
A block relationship determining unit that includes a common variable between blocks, the variable is a change variable in one block, and a reference variable in the other block;
A source code analyzing apparatus.
前記ブロック関係判別手段は、前記特定された階層構造における特定のブロックの下位の各ブロックについて、前記依存関係を判別する、
請求項1に記載のソースコード解析装置。 The structure analyzing means further specifies a hierarchical structure of the block,
The block relationship determining means determines the dependency relationship for each block below a specific block in the specified hierarchical structure.
The source code analysis apparatus according to claim 1.
請求項2に記載のソースコード解析装置。 A block designating unit for accepting designation of the specific block;
The source code analysis apparatus according to claim 2.
請求項1から3の何れか1項に記載のソースコード解析装置。 Comprising a block diagram creating means for creating a block diagram showing a dependency relationship between the blocks determined by the block relationship determining means;
The source code analysis apparatus according to any one of claims 1 to 3.
前記依存関係にあると判別したブロックに対応する図形間を矢印線で結んだブロック構成図を作成する、
請求項4に記載のソースコード解析装置。 The configuration diagram creating means includes:
Create a block configuration diagram that connects arrows corresponding to the blocks determined to be in the dependency relationship,
The source code analysis apparatus according to claim 4.
請求項5に記載のソースコード解析装置。 The configuration diagram creating means creates a block configuration diagram including the variable name of the variable that is commonly included among the blocks in the dependency relationship, on the one hand the change variable and the reference variable on the other side,
The source code analysis apparatus according to claim 5.
請求項4から6の何れか1項に記載のソースコード解析装置。 Display means for displaying a block configuration diagram created by the configuration diagram creation means;
The source code analyzer according to any one of claims 4 to 6.
請求項7に記載のソースコード解析装置。 The display means displays a portion of the source code corresponding to the designated block when the designation of the block displayed in the block configuration diagram is received.
The source code analysis apparatus according to claim 7.
変数判別手段が、特定したブロックごとに、前記ブロックに含まれる変数であって値が変更される変更変数と値が参照される参照変数とを判別し、
ブロック関係判別手段が、ブロック間で共通の変数を含み、当該変数が一方のブロックで変更変数であり、他方のブロックで参照変数である場合に、前記ブロック間が依存関係にあると判別する、
ソースコード解析方法。 The structure analysis means identifies the blocks constituting the source code of the program based on a predetermined identifier,
The variable determining means determines, for each identified block, a variable that is a variable included in the block and whose value is changed, and a reference variable whose value is referenced,
The block relationship determining means determines that the block is in a dependency relationship when the variable includes a common variable among the blocks, the variable is a change variable in one block, and a reference variable in the other block.
Source code analysis method.
プログラムのソースコードを解析して、当該ソースコードを構成するブロックを特定する構造解析手段、
前記特定されたブロックごとに、前記ブロックに含まれる変数であって値が変更される変更変数と値が参照される参照変数とを判別する変数判別手段、
前記変数判別手段による判別結果に基づいて、一方の変更が他方に影響を及ぼす関係にあるブロック間を判別するブロック関係判別手段、
として機能させるためのプログラム。 Computer
Structural analysis means for analyzing the source code of the program and identifying the blocks constituting the source code,
Variable determination means for determining, for each identified block, a change variable that is included in the block and whose value is changed, and a reference variable whose value is referred to;
Block relationship determining means for determining between blocks in a relationship in which one change affects the other based on the determination result by the variable determining means;
Program to function as.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014205926A JP2016076080A (en) | 2014-10-06 | 2014-10-06 | Source code analyzing apparatus, source code analyzing method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014205926A JP2016076080A (en) | 2014-10-06 | 2014-10-06 | Source code analyzing apparatus, source code analyzing method, and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2016076080A true JP2016076080A (en) | 2016-05-12 |
Family
ID=55949963
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014205926A Pending JP2016076080A (en) | 2014-10-06 | 2014-10-06 | Source code analyzing apparatus, source code analyzing method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2016076080A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017187537A1 (en) * | 2016-04-26 | 2017-11-02 | 三菱電機株式会社 | Dependency relation extraction device and dependency relation extraction program |
JP2018028776A (en) * | 2016-08-17 | 2018-02-22 | 日本電気株式会社 | Software asset management device, software asset management method, and software asset management program |
WO2020261487A1 (en) * | 2019-06-27 | 2020-12-30 | オムロン株式会社 | Analysis device, analysis method, and analysis program |
US11379224B2 (en) | 2017-02-16 | 2022-07-05 | Mitsubishi Electric Corporation | Scale calculation apparatus and computer readable medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH08272596A (en) * | 1995-03-30 | 1996-10-18 | Sumitomo Metal Ind Ltd | Program design generation device |
JPH0916389A (en) * | 1995-07-03 | 1997-01-17 | Nippon Telegr & Teleph Corp <Ntt> | Method and device for automatically generating program parts |
JP2009271572A (en) * | 2008-04-30 | 2009-11-19 | Mitsubishi Electric Corp | Control system development support device |
JP2010282441A (en) * | 2009-06-04 | 2010-12-16 | Sharp Corp | Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength |
JP2013097470A (en) * | 2011-10-28 | 2013-05-20 | Mitsubishi Electric Corp | Source file reuse support device, source file reuse support method and program |
JP2013097494A (en) * | 2011-10-31 | 2013-05-20 | Mitsubishi Electric Corp | Software development support device and program |
JP2013156786A (en) * | 2012-01-30 | 2013-08-15 | Hitachi Automotive Systems Ltd | Software structure visualization program and system |
-
2014
- 2014-10-06 JP JP2014205926A patent/JP2016076080A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH08272596A (en) * | 1995-03-30 | 1996-10-18 | Sumitomo Metal Ind Ltd | Program design generation device |
JPH0916389A (en) * | 1995-07-03 | 1997-01-17 | Nippon Telegr & Teleph Corp <Ntt> | Method and device for automatically generating program parts |
JP2009271572A (en) * | 2008-04-30 | 2009-11-19 | Mitsubishi Electric Corp | Control system development support device |
JP2010282441A (en) * | 2009-06-04 | 2010-12-16 | Sharp Corp | Apparatus for calculating inter-module dependent strength, method and program for measuring inter-module dependent strength |
JP2013097470A (en) * | 2011-10-28 | 2013-05-20 | Mitsubishi Electric Corp | Source file reuse support device, source file reuse support method and program |
JP2013097494A (en) * | 2011-10-31 | 2013-05-20 | Mitsubishi Electric Corp | Software development support device and program |
JP2013156786A (en) * | 2012-01-30 | 2013-08-15 | Hitachi Automotive Systems Ltd | Software structure visualization program and system |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017187537A1 (en) * | 2016-04-26 | 2017-11-02 | 三菱電機株式会社 | Dependency relation extraction device and dependency relation extraction program |
JP2018028776A (en) * | 2016-08-17 | 2018-02-22 | 日本電気株式会社 | Software asset management device, software asset management method, and software asset management program |
US11379224B2 (en) | 2017-02-16 | 2022-07-05 | Mitsubishi Electric Corporation | Scale calculation apparatus and computer readable medium |
WO2020261487A1 (en) * | 2019-06-27 | 2020-12-30 | オムロン株式会社 | Analysis device, analysis method, and analysis program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9733901B2 (en) | Domain specific language design | |
CN105528287A (en) | Apparatus and method for unit test of code | |
JP2016076080A (en) | Source code analyzing apparatus, source code analyzing method, and program | |
JP6440895B2 (en) | Software analysis apparatus and software analysis method | |
JP2013097470A (en) | Source file reuse support device, source file reuse support method and program | |
JP2008242873A (en) | Software automatic configuring device and method | |
JP4870956B2 (en) | Embedded program generation method, embedded program development system, and information table section | |
JP5826099B2 (en) | Software evaluation support apparatus and program | |
JP2008287396A (en) | Data processor and program | |
JP2009053767A (en) | Program analysis device and program analysis method | |
CN113934959A (en) | Program preview method and device, computer equipment and storage medium | |
JP2009151613A (en) | Program source conversion apparatus | |
JP5540856B2 (en) | Apparatus and method for setting a workflow | |
JP2009251666A (en) | Change history preparation apparatus, method, and program | |
CN116009863B (en) | Front-end page rendering method, device and storage medium | |
JP2015035174A (en) | Control program division device, control program division method, and recording medium therefor | |
JP2008107990A (en) | Information processor, coverage measurement method and coverage measurement program | |
US9792197B2 (en) | Apparatus and program | |
JP7059165B2 (en) | Program generator and program generation method | |
JP2013020539A (en) | Multilingual display method and multilingual display program | |
JP6705993B2 (en) | Information processing apparatus, information processing apparatus control method, and program | |
JP2019082896A (en) | Information processing device, processing method and program of the same | |
JP2011165051A (en) | Development support device, method and program | |
JP2007094453A (en) | Program development support system, program development support method and program | |
JP2006294013A (en) | Apparatus for supporting control program development |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20161026 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20161122 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20170117 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20170613 |