JP2007299082A - Source code generation device, source code generation method, and source code generation program - Google Patents

Source code generation device, source code generation method, and source code generation program Download PDF

Info

Publication number
JP2007299082A
JP2007299082A JP2006124687A JP2006124687A JP2007299082A JP 2007299082 A JP2007299082 A JP 2007299082A JP 2006124687 A JP2006124687 A JP 2006124687A JP 2006124687 A JP2006124687 A JP 2006124687A JP 2007299082 A JP2007299082 A JP 2007299082A
Authority
JP
Japan
Prior art keywords
determination
state transition
source code
state
code generation
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.)
Granted
Application number
JP2006124687A
Other languages
Japanese (ja)
Other versions
JP4670724B2 (en
Inventor
Masatoshi Tsuyuki
正年 露木
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Holdings 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 Fuji Electric Holdings Ltd filed Critical Fuji Electric Holdings Ltd
Priority to JP2006124687A priority Critical patent/JP4670724B2/en
Publication of JP2007299082A publication Critical patent/JP2007299082A/en
Application granted granted Critical
Publication of JP4670724B2 publication Critical patent/JP4670724B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To select a description format of the transition conditions of a state transition diagram from among a plurality of description formats, and to generate a source code having a structure suitable for the selected description format from the state transition diagram. <P>SOLUTION: A state transition diagram storage means 11 stores a state transition diagram 2. An input screen display means 12 displays an input screen equipped with a selection region for selecting the description format of the transition conditions and a description region for describing transition conditions. A transition condition information acquiring means 13 accepts an operation input to the input screen, and acquires transition condition information 4 equipped with the information of the selected description format and the description of the transition conditions. A source code generation means 14 generates a decision code by using a decision code generating function corresponding to the description format from the description of each transition condition, and generates a processing code describing any processing other than the condition decision from the state transition diagram 2, and synthesizes the processing code and the decision code, and outputs a source code 5. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明はプログラムのソースコードを生成するソースコード生成装置、ソースコード生成方法およびソースコード生成プログラムに関し、特に状態遷移図からプログラムのソースコードを生成するソースコード生成装置、ソースコード生成方法およびソースコード生成プログラムに関する。   The present invention relates to a source code generation device, a source code generation method, and a source code generation program for generating a program source code, and more particularly to a source code generation device, a source code generation method, and a source code for generating a program source code from a state transition diagram. It relates to the generation program.

現在、コンピュータで実行されるソフトウェアが大規模化、複雑化するに伴い、ソフトウェアの設計を効率的に行うために多種多様な図が使用されている。例えば、実行する処理の結果に応じてプログラムの状態が変化していくソフトウェアを設計する場合、状態遷移図が使用される。状態遷移図は、状態を表すノードと、状態間の遷移を表す矢印線とから構成される。また、それぞれの状態遷移に対して、その遷移が生起する条件を示す遷移条件が付加されることがある。状態遷移図は、標準化されたモデル記述言語であるUML(Unified Modeling Language)においても状態機械(State Machine)として採用されており、広く一般に使用されている。状態遷移図を記述することで、開発者はプログラムの振る舞いを容易に把握することができる。   Currently, as software executed on a computer becomes larger and more complicated, a wide variety of diagrams are used to efficiently design software. For example, when designing software in which the state of a program changes according to the result of processing to be executed, a state transition diagram is used. The state transition diagram includes nodes representing states and arrow lines representing transitions between states. In addition, a transition condition indicating a condition in which the transition occurs may be added to each state transition. The state transition diagram is also adopted as a state machine in UML (Unified Modeling Language), which is a standardized model description language, and is widely used. By describing the state transition diagram, developers can easily understand the behavior of the program.

一方、ソフトウェアをコンピュータで実行させるためには、最終的にプログラムのソースコードを記述しなければならない。そのため、開発者は状態遷移図を記述して設計を行った後、それに基づいて改めてソースコードを記述する必要がある。状態遷移図の記述とソースコードの記述という二重の作業は、開発者にとって大きな負担となる。   On the other hand, in order for software to be executed on a computer, the source code of the program must be finally written. Therefore, the developer needs to describe the state transition diagram and design it, and then write the source code again based on the design. The double task of describing the state transition diagram and describing the source code is a heavy burden on the developer.

そこで、開発者の作業負担を軽減すべく、遷移条件が付加された状態遷移図から、状態遷移図で表される振る舞いを実現するプログラムのソースコードを自動的に生成する技術が知られている(例えば、特許文献1参照)。この方法では、現在の状態を示す値を格納する変数と、状態遷移図に記述された遷移条件が満たされたときに変数の値を更新する関数とを備えるソースコードが生成される。これにより、プログラムの実行中に状態が変化するソフトウェアの開発の負担が大きく軽減される。
特開平7−78076号公報
Therefore, in order to reduce the workload of developers, a technology is known that automatically generates the source code of a program that realizes the behavior represented by the state transition diagram from the state transition diagram to which transition conditions are added. (For example, refer to Patent Document 1). In this method, source code including a variable that stores a value indicating the current state and a function that updates the value of the variable when a transition condition described in the state transition diagram is satisfied is generated. This greatly reduces the burden of developing software whose state changes during program execution.
JP 7-78076 A

しかし、特許文献1記載の技術では遷移条件の記述方法が固定されており、生成されるソースコードの構造も遷移条件の記述内容に関わらず一定であるという問題がある。遷移条件を記述する際には、条件の複雑さなどの性質に応じて記述形式を変えたいという要求がある。例えば、簡単な遷移条件は論理式を用いることで簡潔に記述できる一方、複雑な遷移条件は条件判定を行う計算の手順を記述する方が理解容易な記述になる。また、遷移条件の記述とソースコードとの対応関係が固定的であると、記述形式によっては著しく処理効率が悪い構造のソースコードが生成されることがある。例えば、遷移条件の記述が1つの論理式のみから成る簡単な記述であっても、複雑な構造をもつ冗長なソースコードが生成されることがある。   However, the technique described in Patent Document 1 has a problem that the transition condition description method is fixed, and the structure of the generated source code is constant regardless of the description contents of the transition condition. When describing a transition condition, there is a demand to change the description format in accordance with the properties such as the complexity of the condition. For example, a simple transition condition can be described concisely by using a logical expression, while a complicated transition condition can be described more easily by describing a calculation procedure for performing condition determination. In addition, if the correspondence between the description of the transition condition and the source code is fixed, a source code having a structure with extremely low processing efficiency may be generated depending on the description format. For example, even if the description of the transition condition is a simple description consisting of only one logical expression, redundant source code having a complicated structure may be generated.

本発明はこのような点に鑑みてなされたものであり、状態遷移図の遷移条件の記述形式を複数の記述形式の中から選択でき、選択された記述形式に適した構造をもつソースコードを状態遷移図から自動的に生成するソースコード生成装置、ソースコード生成方法およびソースコード生成プログラムを提供することを目的とする。   The present invention has been made in view of the above points, and the description format of the transition condition of the state transition diagram can be selected from a plurality of description formats, and source code having a structure suitable for the selected description format is obtained. It is an object to provide a source code generation device, a source code generation method, and a source code generation program that are automatically generated from a state transition diagram.

本発明では上記問題を解決するために、状態遷移図からプログラムのソースコードを生成するソースコード生成装置において、プログラムの状態と前記状態間の状態遷移の関係とを記述した状態遷移図を記憶する状態遷移図記憶手段と、前記状態遷移図記憶手段に記憶された前記状態遷移図の前記状態遷移それぞれについて、前記状態遷移が生起する条件を示す遷移条件の記述形式を、予め設定された複数の前記記述形式の一覧から選択させる選択領域と、選択された前記記述形式に従って前記遷移条件を記述するための記述領域とを備える入力画面を表示する入力画面表示手段と、前記入力画面表示手段で表示した前記入力画面に対する操作入力を受け付け、選択された前記記述形式の情報と前記遷移条件の記述とを備える遷移条件情報を取得する遷移条件情報取得手段と、前記入力画面で選択可能な前記記述形式それぞれに対応付けて、前記記述形式に従って記述された前記遷移条件から条件判定を行う判定コードを生成する判定コード生成機能を有しており、前記遷移条件情報取得手段が前記状態遷移図記憶手段に記憶された前記状態遷移図のすべての前記状態遷移について前記遷移条件情報を取得すると、前記状態遷移ごとに前記遷移条件情報で示される前記記述形式に対応する前記判定コード生成機能を呼び出して前記判定コードを生成すると共に、前記状態遷移図から前記条件判定以外の処理を記述した処理コードを生成し、生成した前記処理コードとすべての前記判定コードとを合成してプログラムのソースコードを出力するソースコード生成手段と、を有することを特徴とするソースコード生成装置が提供される。   In the present invention, in order to solve the above problem, in a source code generation device that generates a source code of a program from a state transition diagram, a state transition diagram that describes the state of the program and the state transition relationship between the states is stored. For each of the state transitions of the state transition diagram storage unit and the state transition diagram stored in the state transition diagram storage unit, a plurality of preset description formats of transition conditions indicating conditions under which the state transition occurs are set. An input screen display means for displaying an input screen comprising a selection area to be selected from the description format list and a description area for describing the transition condition according to the selected description format; and display by the input screen display means The transition condition information including the selected description format information and the transition condition description is received. A transition condition information acquisition means to be obtained, and a determination code generation function for generating a determination code for performing a condition determination from the transition condition described according to the description format in association with each description format selectable on the input screen. When the transition condition information acquisition unit acquires the transition condition information for all the state transitions of the state transition diagram stored in the state transition diagram storage unit, the transition condition information is obtained for each state transition. The determination code generation function corresponding to the description format shown is called to generate the determination code, and a processing code describing processing other than the condition determination is generated from the state transition diagram, and the generated processing code and Source code generation means for synthesizing all the determination codes and outputting the source code of the program Source code generating device is provided, wherein.

このようなソースコード生成装置によれば、入力画面表示手段により、状態遷移図の状態遷移それぞれについて、遷移条件の記述形式を選択する選択領域と遷移条件を記述する記述領域とを備える入力画面が表示される。次に、遷移条件情報取得手段により、入力画面で選択された記述形式の情報と入力された遷移条件の記述とを備える遷移条件情報が取得される。そして、ソースコード生成手段により、それぞれの遷移条件の記述形式に応じて適切な構造をもつ判定コードが生成されると共に、状態遷移図から条件判定以外の処理を記述した処理コードが生成され、処理コードと判定コードとが合成されてプログラムのソースコードが生成される。   According to such a source code generation device, an input screen including a selection area for selecting a transition condition description format and a description area for describing a transition condition for each state transition of the state transition diagram is displayed by the input screen display means. Is displayed. Next, the transition condition information acquisition means acquires transition condition information including information in the description format selected on the input screen and the description of the input transition condition. Then, the source code generation means generates a determination code having an appropriate structure according to the description format of each transition condition, and also generates a processing code describing processing other than the condition determination from the state transition diagram. The code and the determination code are combined to generate a program source code.

また、上記問題を解決するために、プログラムの状態と前記状態間の状態遷移の関係とを記述した状態遷移図からプログラムのソースコードを生成するソースコード生成方法において、入力画面表示手段が、状態遷移図記憶手段に記憶された前記状態遷移図の前記状態遷移それぞれについて、前記状態遷移が生起する条件を示す遷移条件の記述形式を、予め設定された複数の前記記述形式の一覧から選択させる選択領域と、選択された前記記述形式に従って前記遷移条件を記述するための記述領域とを備える入力画面を表示し、遷移条件情報取得手段が、前記入力画面表示手段で表示した前記入力画面に対する操作入力を受け付け、選択された前記記述形式の情報と前記遷移条件の記述とを備える遷移条件情報を取得し、ソースコード生成手段が、前記入力画面で選択可能な前記記述形式それぞれと対応付けて、前記記述形式に従って記述された前記遷移条件から条件判定を行う判定コードを生成する判定コード生成機能を有しており、前記遷移条件情報取得手段が前記状態遷移図記憶手段に記憶された前記状態遷移図のすべての前記状態遷移について前記遷移条件情報を取得すると、前記状態遷移ごとに前記遷移条件情報で示される前記記述形式に対応する前記判定コード生成機能を呼び出して前記判定コードを生成すると共に、前記状態遷移図から前記条件判定以外の処理を記述した処理コードを生成し、生成した前記処理コードとすべての前記判定コードとを合成してプログラムのソースコードを出力する、ことを特徴とするソースコード生成方法が提供される。   In order to solve the above problem, in the source code generation method for generating the source code of the program from the state transition diagram describing the state of the program and the state transition relationship between the states, the input screen display means includes a state Selection for selecting a description format of a transition condition indicating a condition in which the state transition occurs for each of the state transitions stored in the transition diagram storage means from a list of a plurality of preset description formats An input screen including an area and a description area for describing the transition condition according to the selected description format is displayed, and a transition condition information acquisition unit performs an operation input on the input screen displayed by the input screen display unit To obtain transition condition information including information on the selected description format and a description of the transition condition, and generate source code Has a determination code generation function for generating a determination code for performing a condition determination from the transition condition described according to the description format in association with each of the description formats selectable on the input screen. When the condition information acquisition unit acquires the transition condition information for all the state transitions of the state transition diagram stored in the state transition diagram storage unit, the description format indicated by the transition condition information for each state transition The corresponding determination code generation function is called to generate the determination code, a processing code describing processing other than the condition determination is generated from the state transition diagram, and the generated processing code and all the determination codes A source code generation method is provided that outputs the source code of a program by synthesizing.

このようなソースコード生成方法によれば、状態遷移図の状態遷移それぞれについて、遷移条件の記述形式を選択する選択領域と遷移条件を記述する記述領域とを備える入力画面が表示される。次に、入力画面で選択された記述形式の情報と入力された遷移条件の記述とを備える遷移条件情報が取得される。そして、それぞれの遷移条件の記述形式に応じて適切な構造をもつ判定コードが生成されると共に、状態遷移図から条件判定以外の処理を記述した処理コードが生成され、処理コードと判定コードとが合成されてプログラムのソースコードが生成される。   According to such a source code generation method, an input screen including a selection area for selecting a transition condition description format and a description area for describing a transition condition is displayed for each state transition in the state transition diagram. Next, transition condition information including the description format information selected on the input screen and the input transition condition description is acquired. Then, a determination code having an appropriate structure is generated according to the description format of each transition condition, and a processing code describing processing other than the condition determination is generated from the state transition diagram, and the processing code and the determination code are The source code of the program is generated by synthesis.

また、上記問題を解決するために、状態遷移図からプログラムのソースコードを生成するソースコード生成プログラムにおいて、コンピュータを、プログラムの状態と前記状態間の状態遷移の関係とを記述した状態遷移図を記憶する状態遷移図記憶手段、前記状態遷移図記憶手段に記憶された前記状態遷移図の前記状態遷移それぞれについて、前記状態遷移が生起する条件を示す遷移条件の記述形式を、予め設定された複数の前記記述形式の一覧から選択させる選択領域と、選択された前記記述形式に従って前記遷移条件を記述するための記述領域とを備える入力画面を表示する入力画面表示手段、前記入力画面表示手段で表示した前記入力画面に対する操作入力を受け付け、選択された前記記述形式の情報と前記遷移条件の記述とを備える遷移条件情報を取得する遷移条件情報取得手段、前記入力画面で選択可能な前記記述形式それぞれに対応して、前記記述形式に従って記述された前記遷移条件から条件判定を行う判定コードを生成する判定コード生成機能を有しており、前記遷移条件情報取得手段が前記状態遷移図記憶手段に記憶された前記状態遷移図のすべての前記状態遷移について前記遷移条件情報を取得すると、前記状態遷移ごとに前記遷移条件情報で示される前記記述形式に対応する前記判定コード生成機能を呼び出して前記判定コードを生成すると共に、前記状態遷移図から前記条件判定以外の処理を記述した処理コードを生成し、生成した前記処理コードとすべての前記判定コードとを合成してプログラムのソースコードを出力するソースコード生成手段、として機能させることを特徴とするソースコード生成プログラムが提供される。   In order to solve the above problem, in the source code generation program for generating the source code of the program from the state transition diagram, the computer describes a state transition diagram describing the state of the program and the state transition relationship between the states. A state transition diagram storage means for storing, a plurality of preset description formats of transition conditions indicating conditions under which the state transition occurs for each of the state transitions of the state transition diagram stored in the state transition diagram storage means Input screen display means for displaying an input screen comprising a selection area to be selected from the list of description formats and a description area for describing the transition condition according to the selected description format, and displayed on the input screen display means The operation input to the input screen is received, and the selected description format information and the transition condition description are provided. Transition condition information acquisition means for acquiring transition condition information, a determination code for generating a determination code for performing a condition determination from the transition condition described according to the description format corresponding to each description format selectable on the input screen Having the generation function, and when the transition condition information acquisition unit acquires the transition condition information for all the state transitions of the state transition diagram stored in the state transition diagram storage unit, for each state transition The determination code generation function corresponding to the description format indicated by the transition condition information is called to generate the determination code, and a processing code describing processing other than the condition determination is generated from the state transition diagram and generated. Source code generating means for synthesizing the processing code and all the determination codes and outputting a source code of the program; Source code generator for causing the function is provided.

このようなソースコード生成プログラムを実行するコンピュータによれば、入力画面表示手段により、状態遷移図の状態遷移それぞれについて、遷移条件の記述形式を選択する選択領域と遷移条件を記述する記述領域とを備える入力画面が表示される。次に、遷移条件情報取得手段により、入力画面で選択された記述形式の情報と入力された遷移条件の記述とを備える遷移条件情報が取得される。そして、ソースコード生成手段により、それぞれの遷移条件の記述形式に応じて適切な構造をもつ判定コードが生成されると共に、状態遷移図から条件判定以外の処理を記述した処理コードが生成され、処理コードと判定コードとが合成されてプログラムのソースコードが生成される。   According to the computer that executes such a source code generation program, the input screen display means, for each state transition of the state transition diagram, selects a selection area for selecting a transition condition description format and a description area for describing the transition condition. An input screen is provided. Next, the transition condition information acquisition means acquires transition condition information including information in the description format selected on the input screen and the description of the input transition condition. Then, the source code generation means generates a determination code having an appropriate structure according to the description format of each transition condition, and also generates a processing code describing processing other than the condition determination from the state transition diagram. The code and the determination code are combined to generate a program source code.

本発明では、入力画面において一覧から遷移条件の記述形式を選択できるようにし、選択された記述形式に対応した判定コード生成機能を用いて条件判定を行うコードを生成することとした。これにより、開発者は遷移条件の複雑さなどの性質に応じて適切な記述形式を選択できると共に、選択された記述形式に適した構造をもつソースコードを生成できる。したがって、いずれの記述形式が選択されても冗長なソースコードが生成されることがなくなり、生成されるプログラムの処理効率が向上する。   In the present invention, the description format of the transition condition can be selected from the list on the input screen, and the code for performing the condition determination is generated using the determination code generation function corresponding to the selected description format. As a result, the developer can select an appropriate description format according to the nature of the transition condition and the like, and can generate source code having a structure suitable for the selected description format. Therefore, no redundant source code is generated regardless of which description format is selected, and the processing efficiency of the generated program is improved.

以下、本発明の実施の形態を図面を参照して詳細に説明する。まず、本発明の概要について説明し、その後、実施の形態の具体的な内容を説明する。
図1は、実施の形態に適用される発明の概念図である。図1に示されるソースコード生成装置は、状態遷移図とそれぞれの状態遷移についての遷移条件の詳細な記述とから、ソースコードを自動的に生成するものである。ソースコード生成装置10は、状態遷移図記憶手段11、入力画面表示手段12、遷移条件情報取得手段13およびソースコード生成手段14を有する。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. First, an outline of the present invention will be described, and then specific contents of the embodiment will be described.
FIG. 1 is a conceptual diagram of the invention applied to the embodiment. The source code generation device shown in FIG. 1 automatically generates source code from a state transition diagram and a detailed description of transition conditions for each state transition. The source code generation device 10 includes a state transition diagram storage unit 11, an input screen display unit 12, a transition condition information acquisition unit 13, and a source code generation unit 14.

状態遷移図記憶手段11は、プログラムの状態2a,2bと、状態2a,2b間の状態遷移2cの関係とを記述した状態遷移図2を記憶する。開発者は、予め状態遷移図2を記述し、状態遷移図記憶手段11に格納しておく。ただし、状態遷移図2には、それぞれの遷移条件の詳細は記述しない。   The state transition diagram storage means 11 stores a state transition diagram 2 describing the states 2a and 2b of the program and the relationship of the state transition 2c between the states 2a and 2b. The developer describes the state transition diagram 2 in advance and stores it in the state transition diagram storage means 11. However, details of each transition condition are not described in the state transition diagram 2.

入力画面表示手段12は、状態遷移図記憶手段11に記憶された状態遷移図2の状態遷移それぞれについて、遷移条件の詳細を記述するための入力画面を入出力装置3に表示する。表示される入力画面は、予め設定された複数の記述形式の一覧から遷移条件の記述形式を選択するための選択領域と、選択された記述形式に従って遷移条件を記述するための記述領域とを備える。   The input screen display unit 12 displays an input screen for describing details of the transition condition on the input / output device 3 for each state transition of the state transition diagram 2 stored in the state transition diagram storage unit 11. The displayed input screen includes a selection area for selecting a transition condition description format from a list of a plurality of preset description formats, and a description area for describing the transition condition according to the selected description format. .

遷移条件情報取得手段13は、入出力装置3に表示された入力画面に対する操作入力を受け付け、選択された記述形式の情報と入力された遷移条件の記述とを備える遷移条件情報4を取得する。   The transition condition information acquisition unit 13 receives an operation input for the input screen displayed on the input / output device 3, and acquires the transition condition information 4 including the information in the selected description format and the description of the input transition condition.

ソースコード生成手段14は、入力画面で選択可能な記述形式ごとに、その記述形式で記述された遷移条件から条件判定を行う判定コードを生成する判定コード生成機能14a,14b,14c,・・・を有している。ここで、遷移条件情報取得手段13が状態遷移図記憶手段11に記憶された状態遷移図2のすべての状態遷移について遷移条件情報を取得すると、ソースコード生成手段14はソースコードの生成処理を開始する。   The source code generation unit 14 generates, for each description format selectable on the input screen, determination code generation functions 14a, 14b, 14c,... That generate a determination code for performing a condition determination from the transition conditions described in the description format. have. Here, when the transition condition information acquisition unit 13 acquires the transition condition information for all the state transitions of the state transition diagram 2 stored in the state transition diagram storage unit 11, the source code generation unit 14 starts the source code generation process. To do.

まず、ソースコード生成手段14は、状態遷移ごとに遷移条件情報4で示される記述形式に対応する判定コード生成機能を呼び出して判定コードを生成する。例えば、記述形式が論理式であるとき、判定コード生成機能14aが呼び出される。次に、ソースコード生成手段14は、状態遷移図2から条件判定以外の処理を記述した処理コードを生成する。そして、ソースコード生成手段14は、生成した処理コードとすべての判定コードとを合成してプログラムのソースコード5を出力する。出力されるソースコード5は、状態遷移図2の振る舞いを実現する具体的な処理手順を記述したものである。   First, the source code generation unit 14 generates a determination code by calling a determination code generation function corresponding to the description format indicated by the transition condition information 4 for each state transition. For example, when the description format is a logical expression, the determination code generation function 14a is called. Next, the source code generation unit 14 generates a processing code describing processing other than the condition determination from the state transition diagram 2. Then, the source code generation unit 14 synthesizes the generated processing code and all the determination codes and outputs the source code 5 of the program. The output source code 5 describes a specific processing procedure for realizing the behavior of the state transition diagram 2.

このようなソースコード生成装置10によれば、入力画面表示手段12により、状態遷移図2の状態遷移それぞれについて、記述形式の選択領域と遷移条件の記述領域とを備える入力画面が入出力装置3に表示される。次に、遷移条件情報取得手段13により、入力画面に対する操作入力を受け付け、選択された記述形式の情報と入力された遷移条件の記述とを備える遷移条件情報4が取得される。そして、ソースコード生成手段14により、それぞれの遷移条件の記述形式に応じて適切な構造をもつ判定コードが生成されると共に、状態遷移図2から条件判定以外の処理を記述した処理コードが生成され、処理コードと判定コードとが合成されてプログラムのソースコード5が生成される。   According to such a source code generation device 10, the input screen display unit 12 displays an input screen including a selection area of a description format and a description area of a transition condition for each state transition in the state transition diagram 2. Is displayed. Next, the transition condition information acquisition unit 13 receives an operation input on the input screen, and acquires the transition condition information 4 including the information in the selected description format and the description of the input transition condition. Then, the source code generation unit 14 generates a determination code having an appropriate structure according to the description format of each transition condition, and also generates a processing code describing processing other than the condition determination from the state transition diagram 2. The processing code and the determination code are combined to generate the source code 5 of the program.

これにより、開発者は、それぞれの遷移条件の性質に応じて適切な記述形式を選択して遷移条件を記述できると共に、選択された記述形式に適した構造をもつソースコードを生成できる。したがって、いずれの記述形式が選択されても冗長なソースコードが生成されることがなくなり、生成されるプログラムの処理効率が向上する。また、開発者が適切な記述形式を選択することで、遷移条件の記述や理解が容易となり、開発者の入力ミスを防止できる。その結果、生成されるプログラムの品質も向上する。   As a result, the developer can select a suitable description format according to the nature of each transition condition and describe the transition condition, and can generate source code having a structure suitable for the selected description format. Therefore, no redundant source code is generated regardless of which description format is selected, and the processing efficiency of the generated program is improved. In addition, by selecting an appropriate description format, the developer can easily describe and understand the transition condition, and can prevent an input error of the developer. As a result, the quality of the generated program is also improved.

以下、本発明の実施の形態を、図面を参照して詳細に説明する。本実施の形態は、1つのソースコード生成装置100で構成される。開発者は、ソースコード生成装置100を用いて状態遷移図を記述し、記述した状態遷移図からソースコードを生成することができる。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. This embodiment is composed of one source code generation device 100. A developer can describe a state transition diagram using the source code generation device 100, and can generate a source code from the described state transition diagram.

図2は、ソースコード生成装置のハードウェア構成を示す図である。ソースコード生成装置100は、CPU(Central Processing Unit)101によって装置全体が制御されている。CPU101には、バス107を介してRAM(Random Access Memory)102、ハードディスクドライブ(HDD:Hard Disk Drive)103、グラフィック処理装置104および入力インタフェース105が接続されている。   FIG. 2 is a diagram illustrating a hardware configuration of the source code generation device. The entire source code generation apparatus 100 is controlled by a CPU (Central Processing Unit) 101. A random access memory (RAM) 102, a hard disk drive (HDD) 103, a graphic processing device 104, and an input interface 105 are connected to the CPU 101 via a bus 107.

RAM102には、CPU101に実行させるOS(Operating System)プログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。また、RAM102には、CPU101による処理に必要な各種データが格納される。HDD103には、OSプログラムやアプリケーションプログラムが格納される。   The RAM 102 temporarily stores at least part of an OS (Operating System) program and application programs to be executed by the CPU 101. The RAM 102 stores various data necessary for processing by the CPU 101. The HDD 103 stores an OS program and application programs.

グラフィック処理装置104には、モニタ20が接続されている。グラフィック処理装置104は、CPU101からの命令に従って、画像をモニタ20の画面に表示させる。入力インタフェース105には、キーボード31とマウス32とが接続されている。入力インタフェース105は、キーボード31やマウス32から送られてくる信号を、バス107を介してCPU101に送信する。   A monitor 20 is connected to the graphic processing device 104. The graphic processing device 104 displays an image on the screen of the monitor 20 in accordance with a command from the CPU 101. A keyboard 31 and a mouse 32 are connected to the input interface 105. The input interface 105 transmits a signal sent from the keyboard 31 and the mouse 32 to the CPU 101 via the bus 107.

以上のようなハードウェア構成によって、本実施の形態の処理機能を実現することができる。
次に、ソースコード生成装置100のモジュール構成について説明する。
With the hardware configuration as described above, the processing functions of the present embodiment can be realized.
Next, the module configuration of the source code generation device 100 will be described.

図3は、ソースコード生成装置の機能を示すブロック図である。ソースコード生成装置100は、状態遷移図記憶部110、ソースファイル記憶部120、状態遷移図作成部130、遷移条件記述部140、状態遷移図確認部150およびソースコード生成部160を有する。状態遷移図作成部130、遷移条件記述部140および状態遷移図確認部150は、キーボード31およびマウス32を通じて開発者からの入力を受け付けることができる。また、状態遷移図作成部130、遷移条件記述部140、状態遷移図確認部150およびソースコード生成部160は、モニタ20の画面に処理結果を表示することができる。   FIG. 3 is a block diagram illustrating functions of the source code generation device. The source code generation device 100 includes a state transition diagram storage unit 110, a source file storage unit 120, a state transition diagram creation unit 130, a transition condition description unit 140, a state transition diagram confirmation unit 150, and a source code generation unit 160. The state transition diagram creation unit 130, the transition condition description unit 140, and the state transition diagram confirmation unit 150 can accept input from the developer through the keyboard 31 and the mouse 32. In addition, the state transition diagram creation unit 130, the transition condition description unit 140, the state transition diagram confirmation unit 150, and the source code generation unit 160 can display the processing result on the screen of the monitor 20.

状態遷移図記憶部110は、状態遷移図が記述されたファイルを格納する。状態遷移図には、プログラムの状態と状態間の遷移関係とが記述される。また、状態遷移図記憶部110は、状態遷移図のそれぞれの状態遷移と対応付けられた遷移条件情報を格納する。遷移条件情報は、遷移条件の記述形式を示す情報と、その記述形式に従って記述された遷移条件の詳細とを含んでいる。   The state transition diagram storage unit 110 stores a file in which the state transition diagram is described. In the state transition diagram, the state of the program and the transition relationship between the states are described. In addition, the state transition diagram storage unit 110 stores transition condition information associated with each state transition in the state transition diagram. The transition condition information includes information indicating a description format of the transition condition and details of the transition condition described according to the description format.

ソースファイル記憶部120は、生成されたソースコードが記述されたファイルを格納する。
状態遷移図作成部130は、開発者からの入力に基づいて状態遷移図を作成する。ここで、状態遷移図作成部130は、開発者による状態遷移図の作図を視覚的に支援する機能をもつ。例えば、モニタ20の画面端に表示されたボタンを押すことで、描画領域に状態を表す楕円が配置されるようにする。そして、状態遷移図作成部130は、作成した状態遷移図をファイルに保存し状態遷移図記憶部110に格納する。
The source file storage unit 120 stores a file in which the generated source code is described.
The state transition diagram creation unit 130 creates a state transition diagram based on the input from the developer. Here, the state transition diagram creating unit 130 has a function of visually assisting the developer to draw the state transition diagram. For example, when a button displayed on the screen edge of the monitor 20 is pressed, an ellipse representing a state is arranged in the drawing area. Then, the state transition diagram creation unit 130 saves the created state transition diagram in a file and stores it in the state transition diagram storage unit 110.

遷移条件記述部140は、開発者からの入力によって、状態遷移図作成部130で作成されモニタ20に表示されている状態遷移図の中から1つの状態遷移が選択されると、遷移条件の記述形式を選択するための選択画面を表示する。   When one state transition is selected from the state transition diagrams created by the state transition diagram creating unit 130 and displayed on the monitor 20 by the input from the developer, the transition condition description unit 140 describes the transition condition. Displays a selection screen for selecting a format.

本実施の形態では、選択可能な記述形式として、論理式、判定関数、論理回路の3つの記述形式を用意する。論理式は、変数に具体的な値を代入することで真(True)または偽(False)の判定が可能な式である。判定関数は、真または偽を戻り値として返す関数であり、真偽を判定する過程で行われる計算手順を記述したコードを含む。論理回路は、入力値に基づいて真または偽の値を出力する回路である。論理回路は、同等の意味をもつ論理式に変換することが可能である。   In this embodiment, three description formats of a logical expression, a determination function, and a logic circuit are prepared as selectable description formats. A logical expression is an expression that can be determined to be true or false by assigning a specific value to a variable. The determination function is a function that returns true or false as a return value, and includes a code that describes a calculation procedure performed in the process of determining true or false. The logic circuit is a circuit that outputs a true or false value based on an input value. A logic circuit can be converted into a logical expression having an equivalent meaning.

ここで、モニタ20に表示された選択画面で1つの記述形式が選択されると、遷移条件記述部140は、選択された記述形式に従って遷移条件を記述するための入力画面を表示する。表示された入力画面で遷移条件の記述が入力されると、遷移条件記述部140は、選択された記述形式の情報と入力された遷移条件の記述とを含む遷移条件情報を、選択された状態遷移と対応付けて状態遷移図記憶部110に格納する。   Here, when one description format is selected on the selection screen displayed on the monitor 20, the transition condition description unit 140 displays an input screen for describing the transition condition according to the selected description format. When the description of the transition condition is input on the displayed input screen, the transition condition description unit 140 displays the transition condition information including the information of the selected description format and the description of the input transition condition in the selected state. It is stored in the state transition diagram storage unit 110 in association with the transition.

状態遷移図確認部150は、ソースコードを生成する指示が入力されると、状態遷移図記憶部110を参照して、ソースコードの生成に必要な状態遷移図が作成されているか確認する。また、状態遷移図確認部150は、状態遷移図のすべての状態遷移に対して遷移条件情報が作成されているか確認する。そして、記述に不備がある場合、状態遷移図確認部150は、その旨をモニタ20に表示する。不備がない場合、状態遷移図確認部150は、状態遷移図記憶部110に格納された状態遷移図とすべての遷移条件情報とをソースコード生成部160へ渡す。   When an instruction to generate source code is input, the state transition diagram confirmation unit 150 refers to the state transition diagram storage unit 110 to confirm whether a state transition diagram necessary for generating source code has been created. In addition, the state transition diagram confirmation unit 150 confirms whether transition condition information has been created for all state transitions in the state transition diagram. If the description is incomplete, the state transition diagram confirmation unit 150 displays that fact on the monitor 20. If there is no deficiency, the state transition diagram confirmation unit 150 passes the state transition diagram stored in the state transition diagram storage unit 110 and all transition condition information to the source code generation unit 160.

ソースコード生成部160は、論理式変換部161、判定関数変換部162および論理回路変換部163を有する。論理式変換部161は、論理式の形式で記述された遷移条件から条件判定を行う判定コードを生成する。判定関数変換部162は、判定関数の形式で記述された遷移条件から判定コードを生成する。論理回路変換部163は、論理回路の形式で記述された遷移条件から判定コードを生成する。   The source code generation unit 160 includes a logical expression conversion unit 161, a determination function conversion unit 162, and a logic circuit conversion unit 163. The logical expression conversion unit 161 generates a determination code for performing a condition determination from the transition condition described in the logical expression format. The determination function conversion unit 162 generates a determination code from the transition condition described in the determination function format. The logic circuit conversion unit 163 generates a determination code from the transition condition described in the logic circuit format.

ソースコード生成部160は、状態遷移図と遷移条件情報とを受け取ると、それぞれの状態遷移について、遷移条件の記述形式に対応する生成機能を呼び出して判定コードを生成する。具体的には、記述形式が論理式である場合、ソースコード生成部160は論理式変換部161を呼び出す。記述形式が判定関数である場合、ソースコード生成部160は判定関数変換部162を呼び出す。記述形式が論理回路である場合、ソースコード生成部160は論理回路変換部163を呼び出す。   Upon receiving the state transition diagram and the transition condition information, the source code generation unit 160 generates a determination code for each state transition by calling a generation function corresponding to the transition condition description format. Specifically, when the description format is a logical expression, the source code generation unit 160 calls the logical expression conversion unit 161. When the description format is a determination function, the source code generation unit 160 calls the determination function conversion unit 162. When the description format is a logic circuit, the source code generation unit 160 calls the logic circuit conversion unit 163.

また、ソースコード生成部160は、状態遷移図から条件判定以外の処理を記述した処理コードを生成する。そして、ソースコード生成部160は、生成した処理コードに生成した判定コードを埋め込みソースコードを生成する。その後、ソースコード生成部160は、生成したソースコードをファイルに保存してソースファイル記憶部120に格納すると共に、生成が完了した旨をモニタ20に表示する。   In addition, the source code generation unit 160 generates a processing code describing processing other than the condition determination from the state transition diagram. Then, the source code generation unit 160 embeds the generated determination code in the generated processing code and generates a source code. Thereafter, the source code generation unit 160 stores the generated source code in a file and stores it in the source file storage unit 120, and displays on the monitor 20 that the generation has been completed.

図4は、ソースコードの生成に使用される状態遷移図の例である。状態遷移図ファイル111は、状態遷移図記憶部110に格納されている。状態遷移図ファイル111には、状態111a,111b,111cおよび状態遷移111d,111e,111f,111g,111hが記述されている。   FIG. 4 is an example of a state transition diagram used for generating source code. The state transition diagram file 111 is stored in the state transition diagram storage unit 110. In the state transition diagram file 111, states 111a, 111b, and 111c and state transitions 111d, 111e, 111f, 111g, and 111h are described.

状態を表す楕円内には、その状態の状態名が記述される。例えば、状態111aの状態名は“STATE1”である。
状態遷移を表す矢印線には、それぞれラベルが付加される。ラベルは、イベント名、条件名、アクション名の3つの要素で構成される。イベント名は、プログラムの実行時に発生する可能性があるイベントの名前である。条件名は、状態遷移の遷移条件を識別するための名前であり、“[”と“]”の間に記述される。アクション名は、プログラムによって実行される処理を識別するための名前であり、“/”の右側に記述される。
In the ellipse representing the state, the state name of the state is described. For example, the state name of the state 111a is “STATE1”.
A label is added to each arrow line representing a state transition. The label is composed of three elements: event name, condition name, and action name. The event name is the name of an event that may occur when the program is executed. The condition name is a name for identifying the transition condition of the state transition, and is described between “[” and “]”. The action name is a name for identifying a process executed by the program, and is described on the right side of “/”.

上記のラベルは以下の意味をもつ。現在の状態が矢印元の状態であるときに、イベント名で示されるイベントが発生し、かつ、条件名で示される遷移条件が満たされていると、プログラムの状態が矢印先の状態に遷移する。このとき、状態が遷移する直前に、アクション名で示される処理が実行される。   The above labels have the following meanings: When the current state is the state of the arrow source and the event indicated by the event name occurs and the transition condition indicated by the condition name is satisfied, the program state transitions to the arrow destination state . At this time, immediately before the state transitions, the process indicated by the action name is executed.

例えば、状態遷移111dは、現在の状態が状態111aであるときに“event1−1”で示されるイベントが発生し、“cond1−1”で示される遷移条件が満たされていると、“act1−1”で示される処理が実行された上で、状態が状態111bに遷移することを意味する。なお、遷移条件および実行される処理の詳細は状態遷移図に直接記述せず、付加的情報として別手段で記述する。   For example, in the state transition 111d, when the event indicated by “event1-1” occurs when the current state is the state 111a, and the transition condition indicated by “cond1-1” is satisfied, “act1- It means that the state transitions to the state 111b after the process indicated by 1 ″ is executed. The details of the transition condition and the processing to be executed are not described directly in the state transition diagram, but are described by additional means as additional information.

上記の状態遷移図は、開発者からの入力に基づいて状態遷移図作成部130で作成される。このような状態遷移図によって、プログラムの振る舞いを表現することができる。
次に、遷移条件記述部140がモニタ20に表示する選択画面および入力画面について説明する。
The state transition diagram is created by the state transition diagram creation unit 130 based on an input from the developer. The behavior of the program can be expressed by such a state transition diagram.
Next, the selection screen and the input screen that the transition condition description unit 140 displays on the monitor 20 will be described.

図5は、遷移条件の記述形式の選択画面例を示す図である。選択画面21は、入力領域21a,21b、選択領域21cおよびボタン21dを有する。
入力領域21aは、状態遷移図に記述された条件名のうちの1つを入力するための入力領域である。条件名は、状態遷移図の中の状態遷移と遷移条件情報とを対応付けるために用いられる。入力領域21bは、シンボルを入力するための入力領域である。シンボルは、ソースコード中で遷移条件の条件判定を行うコードを識別するために用いられる。
FIG. 5 is a diagram illustrating a selection screen example of a transition condition description format. The selection screen 21 has input areas 21a and 21b, a selection area 21c, and a button 21d.
The input area 21a is an input area for inputting one of the condition names described in the state transition diagram. The condition name is used to associate the state transition in the state transition diagram with the transition condition information. The input area 21b is an input area for inputting symbols. The symbol is used to identify a code for determining the condition of the transition condition in the source code.

選択領域21cは、遷移条件の記述形式を1つ選択するための選択領域である。具体的には、論理式、判定関数、論理回路の中から1つを選択する。ボタン21dは、入力内容を確定するためのボタンである。ボタン21dが押されると、選択領域21cで選択された記述形式に対応する入力画面が次に表示される。   The selection area 21c is a selection area for selecting one transition condition description format. Specifically, one is selected from a logical expression, a determination function, and a logic circuit. The button 21d is a button for confirming input contents. When the button 21d is pressed, an input screen corresponding to the description format selected in the selection area 21c is displayed next.

例えば、図4に示した状態遷移図の状態遷移111dに対して、条件名を“cond1−1”、シンボルを“Hantei1−1”と入力し、記述形式を“論理式”と選択する。   For example, for the state transition 111d in the state transition diagram shown in FIG. 4, the condition name is “cond1-1”, the symbol is “Huntei1-1”, and the description format is “logical expression”.

図6は、論理式形式による遷移条件の入力画面例を示す図である。入力画面22は、選択画面21の選択領域21cで“論理式”が選択された場合に表示される。入力画面22は、入力領域22aおよびボタン22bを有する。   FIG. 6 is a diagram showing an example of a transition condition input screen in a logical expression format. The input screen 22 is displayed when “logical expression” is selected in the selection area 21 c of the selection screen 21. The input screen 22 has an input area 22a and a button 22b.

入力領域22aは、論理式を入力するための入力領域である。論理式は、ソースコード中で使用される変数、数値などの定数、“&&”(論理積)や“||”(論理和)などの論理演算子、“+”(加算)や“*”(積)などの算術演算子、“>”などの比較演算子を用いて記述される。これら演算子は、C言語などの一般的なプログラミング言語で使用可能な演算子である。例えば、変数“count”の値が“10”以上であるという条件を示す論理式は、“count>=10”と記述できる。   The input area 22a is an input area for inputting a logical expression. Logical expressions are variables used in source code, constants such as numeric values, logical operators such as “&&” (logical product) and “||” (logical sum), “+” (addition) and “*”. It is described using an arithmetic operator such as (product) and a comparison operator such as “>”. These operators are operators that can be used in a general programming language such as C language. For example, a logical expression indicating a condition that the value of the variable “count” is “10” or more can be described as “count> = 10”.

ボタン22bは、入力内容を確定するためのボタンである。ボタン22bが押されると、遷移条件記述部140は、入力領域22aに入力された論理式、選択画面21の入力領域21bに入力されたシンボルおよび記述形式が“論理式”であることを示す情報で構成される遷移条件情報を、選択画面21の入力領域21aに入力された条件名と対応付けて、状態遷移図記憶部110に格納する。   The button 22b is a button for confirming input contents. When the button 22b is pressed, the transition condition description unit 140 indicates that the logical expression input to the input area 22a, the symbol input to the input area 21b of the selection screen 21 and the description format are “logical expression”. Is stored in the state transition diagram storage unit 110 in association with the condition name input in the input area 21a of the selection screen 21.

図7は、判定関数形式による遷移条件の入力画面例を示す図である。入力画面23は、選択画面21の選択領域21cで“判定関数”が選択された場合に表示される。入力画面23は、入力領域23aおよびボタン23bを有する。   FIG. 7 is a diagram illustrating an example of a transition condition input screen in the determination function format. The input screen 23 is displayed when “determination function” is selected in the selection area 21 c of the selection screen 21. The input screen 23 has an input area 23a and a button 23b.

入力領域23aは、判定関数を入力するための入力領域である。判定関数は、出力するソースコードの記述に使用されるプログラミング言語の文法に従って記述する。本実施の形態では、プログラミング言語としてC言語を用いている。入力領域23aには、条件判定の過程で行われる計算の手順を示すコードを記述できる。ただし、最終的に戻り値として真または偽の値を返すように記述する必要がある。なお、入力領域23aには、判定関数の処理内容のコードを記述すればよく、関数名などの宣言文を記述する必要はない。必要な宣言文はソースコード生成装置100が自動的に付加する。   The input area 23a is an input area for inputting a determination function. The determination function is described according to the grammar of the programming language used to describe the source code to be output. In the present embodiment, C language is used as the programming language. In the input area 23a, a code indicating a calculation procedure performed in the condition determination process can be described. However, it is necessary to describe so as to finally return a true or false value as a return value. In addition, what is necessary is just to describe the code | cord | chord of the processing content of a determination function in the input area 23a, and it is not necessary to describe declaration statements, such as a function name. Necessary declaration statements are automatically added by the source code generation device 100.

ボタン23bは、入力内容を確定するためのボタンである。ボタン23bが押されると、遷移条件記述部140は、入力領域23aに入力された判定関数、選択画面21の入力領域21bに入力されたシンボルおよび記述形式が“判定関数”であることを示す情報で構成される遷移条件情報を、選択画面21の入力領域21aに入力された条件名と対応付けて、状態遷移図記憶部110に格納する。   The button 23b is a button for confirming input contents. When the button 23b is pressed, the transition condition description unit 140 indicates that the determination function input to the input area 23a, the symbol input to the input area 21b of the selection screen 21 and the description format are “determination function”. Is stored in the state transition diagram storage unit 110 in association with the condition name input in the input area 21a of the selection screen 21.

図8は、論理回路形式による遷移条件の入力画面例を示す図である。入力画面24は、選択画面21の選択領域21cで“論理回路”が選択された場合に表示される。入力画面24は、要素ボタン24a,24b,24c,24d,24e,24f,24g、描画領域24hおよびボタン24iを有する。   FIG. 8 is a diagram showing an example of a transition condition input screen in the logic circuit format. The input screen 24 is displayed when “logic circuit” is selected in the selection area 21 c of the selection screen 21. The input screen 24 includes element buttons 24a, 24b, 24c, 24d, 24e, 24f, 24g, a drawing area 24h, and buttons 24i.

要素ボタン24a,24b,24c,24d,24e,24f,24gは、開発者による論理回路の作図を視覚的に支援するためのボタンである。要素ボタン24a,24b,24c,24d,24e,24f,24gのいずれかのボタンが押されると、そのボタンに対応する回路要素が描画領域24hに配置される。   The element buttons 24a, 24b, 24c, 24d, 24e, 24f, and 24g are buttons for visually assisting a developer to draw a logic circuit. When any one of the element buttons 24a, 24b, 24c, 24d, 24e, 24f, and 24g is pressed, a circuit element corresponding to the button is arranged in the drawing area 24h.

要素ボタン24aは、入力要素を示すボタンである。入力要素は論理回路の入力変数を表す。それぞれの入力要素には変数名が設定される。要素ボタン24bは、定数要素を示すボタンである。定数要素は定数を表す。それぞれの定数要素には数値などの具体的な値が設定される。   The element button 24a is a button indicating an input element. The input element represents an input variable of the logic circuit. A variable name is set for each input element. The element button 24b is a button indicating a constant element. The constant element represents a constant. Each constant element is set to a specific value such as a numerical value.

要素ボタン24cは、比較要素を示すボタンである。比較要素は、“+”の側に入力される値と“−”の側に入力される値とを比較し、“+”の側の値の方が大きい場合は“1”(真)を出力し、それ以外の場合は“0”(偽)を出力する。要素ボタン24dは、加減算要素を示すボタンである。加減算要素は、入力される値をすべて合計した値を出力する。ただし、“−”が付された側から入力される値は、符号を反転させて合計する。   The element button 24c is a button indicating a comparison element. The comparison element compares the value input on the “+” side with the value input on the “−” side, and sets “1” (true) if the value on the “+” side is larger. Otherwise, output “0” (false). The element button 24d is a button indicating an addition / subtraction element. The addition / subtraction element outputs a value obtained by adding up all input values. However, the values input from the side to which “-” is attached are summed with the signs reversed.

要素ボタン24eは、論理積要素を示すボタンである。論理積要素は、入力される値がすべて“0”以外(真)の場合は“1”(真)を出力し、それ以外の場合は“0”(偽)を出力する。要素ボタン24fは、論理和要素を示すボタンである。論理和要素は、入力される値がすべて“0”(偽)の場合には“0”(偽)を出力し、それ以外の場合には“1”(真)を出力する。要素ボタン24gは、出力要素を示すボタンである。出力要素は論理回路の出力を表す。出力要素は論理回路で1つだけ記述できる。   The element button 24e is a button indicating a logical product element. The logical product element outputs “1” (true) when all input values are other than “0” (true), and outputs “0” (false) otherwise. The element button 24f is a button indicating a logical sum element. The logical sum element outputs “0” (false) when all the input values are “0” (false), and outputs “1” (true) otherwise. The element button 24g is a button indicating an output element. The output element represents the output of the logic circuit. Only one output element can be described by a logic circuit.

描画領域24hは、論理回路を描画するための描画領域である。開発者は、要素ボタン24a,24b,24c,24d,24e,24f,24gを用いて回路要素を描画領域24hに配置し、配置した回路要素を線で接続して入出力関係を定義する。   The drawing area 24h is a drawing area for drawing a logic circuit. The developer uses the element buttons 24a, 24b, 24c, 24d, 24e, 24f, and 24g to arrange circuit elements in the drawing area 24h, and defines the input / output relationship by connecting the arranged circuit elements with lines.

ボタン24iは、入力内容を確定するためのボタンである。ボタン24iが押されると、遷移条件記述部140は、描画領域24hに入力された論理回路、選択画面21の入力領域21bに入力されたシンボルおよび記述形式が“論理回路”であることを示す情報で構成される遷移条件情報を、選択画面21の入力領域21aに入力された条件名と対応付けて、状態遷移図記憶部110に格納する。   The button 24i is a button for confirming input contents. When the button 24i is pressed, the transition condition description unit 140 displays information indicating that the logic circuit input to the drawing area 24h, the symbol input to the input area 21b of the selection screen 21 and the description format are “logic circuit”. Is stored in the state transition diagram storage unit 110 in association with the condition name input in the input area 21a of the selection screen 21.

このように、開発者は、選択画面21および入力画面22,23,24を用いて、遷移条件の詳細を入力することができる。なお、本実施の形態では選択画面21および入力画面22,23,24をそれぞれ別個の画面としたが、これらを1つの画面としてもよい。   Thus, the developer can input details of the transition condition using the selection screen 21 and the input screens 22, 23, and 24. In this embodiment, the selection screen 21 and the input screens 22, 23, and 24 are separate screens, but these may be a single screen.

次に、以上のような装置の構成および入力データの構造のもとで実行されるソースコード生成処理の詳細を説明する。
図9は、ソースコード生成処理の手順を示すフローチャートである。以下、図9に示す処理をステップ番号に沿って説明する。
Next, the details of the source code generation process executed under the above-described apparatus configuration and input data structure will be described.
FIG. 9 is a flowchart illustrating a procedure of source code generation processing. In the following, the process illustrated in FIG. 9 will be described in order of step number.

[ステップS11]ソースコード生成部160は、状態遷移図確認部150から状態遷移図とそれぞれの状態遷移に対応する遷移条件情報とを受け取ると、状態遷移図に記述されたそれぞれの状態遷移について、以下のステップS12からステップS20までの処理を繰り返す。   [Step S11] When the source code generation unit 160 receives the state transition diagram and the transition condition information corresponding to each state transition from the state transition diagram confirmation unit 150, for each state transition described in the state transition diagram, The following processes from step S12 to step S20 are repeated.

[ステップS12]ソースコード生成部160は、ステップS11で選択した状態遷移に付加された条件名と対応付けられている遷移条件情報から、記述形式の情報を抽出する。そして、ソースコード生成部160は、遷移条件の記述形式が論理回路であるか否か判断する。論理回路である場合には、処理がステップS13に進められる。論理回路でない場合には、処理がステップS16に進められる。   [Step S12] The source code generation unit 160 extracts description format information from the transition condition information associated with the condition name added to the state transition selected in Step S11. Then, the source code generation unit 160 determines whether or not the transition condition description format is a logic circuit. If it is a logic circuit, the process proceeds to step S13. If it is not a logic circuit, the process proceeds to step S16.

[ステップS13]ソースコード生成部160は、ステップS11で選択した状態遷移に対応する遷移条件情報を論理回路変換部163へ渡す。論理回路変換部163は、受け取った遷移条件情報から遷移条件である論理回路を抽出し、抽出した論理回路を同等の意味をもつ論理式に変換する。論理回路から論理式への変換方法は、後で詳細に説明する。   [Step S13] The source code generation unit 160 passes the transition condition information corresponding to the state transition selected in Step S11 to the logic circuit conversion unit 163. The logic circuit conversion unit 163 extracts a logic circuit that is a transition condition from the received transition condition information, and converts the extracted logic circuit into a logical expression having an equivalent meaning. A method for converting a logic circuit to a logic expression will be described in detail later.

[ステップS14]論理回路変換部163は、ステップS13で変換した論理式を含む判定関数のコードを生成する。具体的には、論理回路変換部163は、ステップS13で受け取った遷移条件情報に含まれるシンボルを判定関数の関数名とし、ステップS13で変換した論理式の評価結果が真の場合には“true”を、偽の場合には“false”を戻り値として返す判定関数のコードを生成する。   [Step S14] The logic circuit conversion unit 163 generates a code of a determination function including the logical expression converted in step S13. Specifically, the logic circuit conversion unit 163 uses the symbol included in the transition condition information received in step S13 as the function name of the determination function, and if the evaluation result of the logical expression converted in step S13 is true, “true” ", And if it is false, a determination function code that returns" false "as a return value is generated.

[ステップS15]論理回路変換部163は、ステップS14で生成した判定関数を呼び出す関数呼び出し文を作成し、作成した関数呼び出し文を埋め込んだ条件分岐のコードを生成する。   [Step S15] The logic circuit conversion unit 163 creates a function call statement that calls the determination function generated in step S14, and generates a conditional branch code in which the created function call statement is embedded.

[ステップS16]ソースコード生成部160は、ステップS12で抽出した記述形式の情報に基づいて、遷移条件の記述形式が判定関数であるか否か判断する。判定関数である場合には、処理がステップS17に進められる。判定関数でない場合には、処理がステップS19に進められる。   [Step S16] The source code generation unit 160 determines whether the description format of the transition condition is a determination function based on the description format information extracted in Step S12. If it is a determination function, the process proceeds to step S17. If not, the process proceeds to Step S19.

[ステップS17]ソースコード生成部160は、ステップS11で選択した状態遷移に対応する遷移条件情報を判定関数変換部162へ渡す。判定関数変換部162は、受け取った遷移条件情報から遷移条件である判定関数を抽出し、遷移条件情報に含まれるシンボルを関数名とする判定関数のコードを生成する。   [Step S17] The source code generation unit 160 passes the transition condition information corresponding to the state transition selected in Step S11 to the determination function conversion unit 162. The determination function conversion unit 162 extracts a determination function that is a transition condition from the received transition condition information, and generates a determination function code having the symbol included in the transition condition information as a function name.

[ステップS18]判定関数変換部162は、ステップS17で生成した判定関数を呼び出す関数呼び出し文を作成し、作成した関数呼び出し文を埋め込んだ条件分岐のコードを生成する。   [Step S18] The decision function conversion unit 162 creates a function call statement that calls the decision function generated in step S17, and generates a conditional branch code in which the created function call statement is embedded.

[ステップS19]ソースコード生成部160は、ステップS12で抽出した記述形式の情報に基づいて、遷移条件の記述形式が論理式であるか否か判断する。論理式である場合には、処理がステップS20に進められる。論理式でない場合には、記述形式の選択が不適切であるため、ステップS11で選択した状態遷移についての処理を終了する。   [Step S19] The source code generation unit 160 determines whether the description format of the transition condition is a logical expression based on the description format information extracted in Step S12. If it is a logical expression, the process proceeds to step S20. If it is not a logical expression, it is inappropriate to select a description format, and the process for the state transition selected in step S11 is terminated.

[ステップS20]ソースコード生成部160は、ステップS11で選択した状態遷移に対応する遷移条件情報を論理式変換部161へ渡す。論理式変換部161は、受け取った遷移条件情報から遷移条件である論理式を抽出し、抽出した論理式が埋め込まれた条件分岐のコードを生成する。   [Step S20] The source code generation unit 160 passes the transition condition information corresponding to the state transition selected in Step S11 to the logical expression conversion unit 161. The logical expression conversion unit 161 extracts a logical expression that is a transition condition from the received transition condition information, and generates a conditional branch code in which the extracted logical expression is embedded.

[ステップS21]ソースコード生成部160は、状態遷移図確認部150から受け取った状態遷移図に基づいて、条件判定以外の処理を記述した処理コードを生成する。状態遷移図からの処理コードの生成は、特許文献1に記載の生成方法などを用いて実現できる。これにより、現在の状態を記憶する変数の宣言、イベントの検出、状態の遷移、状態遷移時の処理の実行などを実現するコードが生成される。ただし、遷移条件を評価して条件分岐を行う箇所には、条件名のみを埋め込んでおく。   [Step S <b> 21] The source code generation unit 160 generates a processing code describing processing other than condition determination based on the state transition diagram received from the state transition diagram confirmation unit 150. Generation of the processing code from the state transition diagram can be realized by using a generation method described in Patent Document 1. As a result, a code that realizes declaration of a variable that stores the current state, detection of an event, state transition, execution of processing at the time of state transition, and the like is generated. However, only the condition name is embedded in the location where the transition condition is evaluated and the conditional branch is performed.

[ステップS22]ソースコード生成部160は、ステップS21で生成された処理コードに埋め込まれた条件名を検出し、検出した箇所の文字列を、ステップS15,S18,S20で生成された対応する条件分岐のコードにそれぞれ置き換える。さらに、ソースコード生成部160は、ステップS14,S17で生成された判定関数のコードを処理コードに追加して、ソースコードを出力する。   [Step S22] The source code generation unit 160 detects the condition name embedded in the processing code generated in step S21, and converts the detected character string into the corresponding conditions generated in steps S15, S18, and S20. Replace with the branch code respectively. Furthermore, the source code generation unit 160 adds the determination function code generated in steps S14 and S17 to the processing code, and outputs the source code.

ここで、ステップS13で行われる論理回路から論理式への変換は、以下の方法で実現できる。まず、ソースコード生成部160は、論理回路のそれぞれの回路要素に対して識別記号を割り当てる。次に、ソースコード生成部160は、回路要素ごとに、識別記号、変数名および定数値を用いて、入力値から出力値を計算する式を作成する。ここで、比較要素では比較演算子“>”、加減算要素では算術演算子“+”または“−”、論理積要素では論理演算子“&&”、論理和要素では論理演算子“||”を演算子としてそれぞれ用いる。例えば、識別記号が“A7”の比較要素において、“+”側の入力に変数名が“c”の変数要素が接続され、“−”側の入力に識別記号が“A8”の加減算要素が接続されているとき、“A7=c>A8”という計算式が作成される。   Here, the conversion from the logic circuit to the logic expression performed in step S13 can be realized by the following method. First, the source code generation unit 160 assigns an identification symbol to each circuit element of the logic circuit. Next, the source code generation unit 160 creates an expression for calculating an output value from an input value using an identification symbol, a variable name, and a constant value for each circuit element. Here, the comparison element is “>”, the addition / subtraction element is the arithmetic operator “+” or “−”, the logical product element is the logical operator “&&”, and the logical sum element is the logical operator “||”. Used as operators. For example, in a comparison element whose identification symbol is “A7”, a variable element whose variable name is “c” is connected to an input on the “+” side, and an addition / subtraction element whose identification symbol is “A8” is connected to an input on the “−” side. When connected, a calculation formula “A7 = c> A8” is created.

そして、ソースコード生成部160は、出力要素に対応する計算式から順に式を展開していく。例えば、“A7=c>A8”と“A8=a−b”の2つの計算式があるとき、前者に後者を代入すると“A7=c>a−b”という計算式が得られる。このようにして計算式を順に展開すると、左辺に出力要素の識別記号のみをもち、右辺に識別記号を含まない式をもつ計算式が作成される。ここで、右辺の式が論理回路と同様の意味をもつ論理式となる。   Then, the source code generation unit 160 develops the formulas in order from the calculation formula corresponding to the output element. For example, when there are two calculation formulas “A7 = c> A8” and “A8 = a−b”, a calculation formula “A7 = c> ab” is obtained by substituting the latter into the former. When the calculation formulas are developed in this way in order, a calculation formula having an expression that has only the output element identification symbol on the left side and no identification symbol on the right side is created. Here, the expression on the right side is a logical expression having the same meaning as the logical circuit.

このようにして、ソースコード生成部160は、状態遷移図と遷移条件情報とから、それぞれの遷移条件の記述形式に応じた構造をもつソースコードを自動的に生成する。
次に、以上のような処理によって生成されるソースコードについて説明する。本実施の形態で生成されるソースコードは、C言語で記述されたものである。
In this way, the source code generation unit 160 automatically generates source code having a structure corresponding to the description format of each transition condition from the state transition diagram and the transition condition information.
Next, source code generated by the above processing will be described. The source code generated in this embodiment is written in C language.

図10は、生成されるソースコード例を示す図である。ソースファイル121は、ソースファイル記憶部120に格納されている。ソースファイル121に記述されたソースコードは、図4に示した状態遷移図に基づいて生成されたものである。なお、状態遷移111dの遷移条件の記述形式は論理式、状態遷移111eの遷移条件の記述形式は判定関数、状態遷移111fの遷移条件の記述形式は論理回路であるとする。   FIG. 10 is a diagram illustrating an example of generated source code. The source file 121 is stored in the source file storage unit 120. The source code described in the source file 121 is generated based on the state transition diagram shown in FIG. The description format of the transition condition of the state transition 111d is a logical expression, the description format of the transition condition of the state transition 111e is a determination function, and the description format of the transition condition of the state transition 111f is a logic circuit.

条件分岐文121aは、プログラムの実行中に発生するイベントを検出するコードである。状態遷移図に記述されたイベント“event1−1”、“event1−2”、“event2−1”、“event2−2”、“event3”のいずれかが発生すると、以後の処理が開始される。   The conditional branch statement 121a is a code for detecting an event that occurs during the execution of the program. When any of the events “event1-1”, “event1-2”, “event2-1”, “event2-2”, “event3” described in the state transition diagram occurs, the subsequent processing is started.

条件分岐文121bは、プログラムの現在の状態に応じて以後の処理の内容を変えるためのコードである。現在の状態が、状態遷移図に記述された状態“STATE1”、“STATE2”、“STATE3”のいずれであるか判断される。   The conditional branch statement 121b is a code for changing the contents of subsequent processing according to the current state of the program. It is determined whether the current state is one of the states “STATE 1”, “STATE 2”, or “STATE 3” described in the state transition diagram.

条件分岐文121cは、状態遷移111dの遷移条件が満たされているか否か判断するコードである。ここで、状態遷移111dの遷移条件の記述形式が論理式であるので、条件分岐文の中に論理式が埋め込まれたコードが生成される。遷移条件が満たされているときは、“act1−1”の処理が実行された後、状態が“STATE2”に遷移する。   The conditional branch sentence 121c is a code for determining whether or not the transition condition of the state transition 111d is satisfied. Here, since the description format of the transition condition of the state transition 111d is a logical expression, a code in which the logical expression is embedded in the conditional branch sentence is generated. When the transition condition is satisfied, the state transitions to “STATE2” after the processing of “act1-1” is executed.

条件分岐文121dは、状態遷移111eの遷移条件が満たされているか否か判断するコードである。ここで、状態遷移111eの遷移条件の記述形式が判定関数であるので、条件分岐文の中に関数呼び出し文が埋め込まれたコードが生成される。遷移条件が満たされているときは、“act1−2”の処理が実行された後、状態が“STATE3”に遷移する。   The conditional branch sentence 121d is a code for determining whether or not the transition condition of the state transition 111e is satisfied. Here, since the description format of the transition condition of the state transition 111e is a determination function, a code in which a function call statement is embedded in a conditional branch statement is generated. When the transition condition is satisfied, after the process of “act1-2” is executed, the state transits to “STATE3”.

条件分岐文121eは、状態遷移111fの遷移条件が満たされているか否か判断するコードである。ここで、状態遷移111fの遷移条件の記述形式が論理回路であるので、条件分岐文の中に関数呼び出し文が埋め込まれたコードが生成される。遷移条件が満たされているときは、“act2−1”の処理が実行された後、状態が“STATE1”に遷移する。   The conditional branch sentence 121e is a code for determining whether or not the transition condition of the state transition 111f is satisfied. Here, since the description format of the transition condition of the state transition 111f is a logic circuit, a code in which a function call statement is embedded in a conditional branch statement is generated. When the transition condition is satisfied, after the process of “act2-1” is executed, the state transitions to “STATE1”.

関数121fは、条件分岐文121dの中で呼び出される判定関数である。関数121fの処理内容のコードは、入力画面23に入力されたコードと同一である。関数121gは、条件分岐文121eの中で呼び出される判定関数である。関数121gの処理内容のコードは、入力画面24に入力された論理回路と同等の意味をもつ論理式に基づいて真偽を判定するコードである。   The function 121f is a determination function called in the conditional branch statement 121d. The code of the processing content of the function 121f is the same as the code input on the input screen 23. The function 121g is a determination function called in the conditional branch statement 121e. The code of the processing content of the function 121g is a code for determining the authenticity based on a logical expression having the same meaning as that of the logic circuit input to the input screen 24.

なお、ソースファイル121では、状態遷移の直前に実行される処理を記述すべき箇所にアクション名のみが記述されているが、予め別手段で処理内容を示すコードを入力しておくことで、そのコードがアクション名の位置に埋め込まれるようにすることができる。また、生成後に開発者がソースコードを編集するようにしてもよい。   Note that in the source file 121, only the action name is described at the location where the processing to be executed immediately before the state transition is to be described, but by inputting a code indicating the processing content by another means in advance, Code can be embedded in the action name position. Further, the developer may edit the source code after generation.

このようなソースコード生成装置を用いることで、開発者は記述する遷移条件の性質に応じて、適切な記述形式を選択することができる。例えば、簡単な遷移条件の場合には、論理式による記述が適切である。遷移条件を判定する過程で複数ステップの計算が必要な場合には、判定関数による記述が適切である。複雑な比較演算や論理演算が必要な遷移条件の場合には、論理回路による記述が適切である。適切な記述形式を選択できることで、開発者の入力ミスが減り、生成されるプログラムの品質が向上する。   By using such a source code generation device, the developer can select an appropriate description format according to the nature of the transition condition to be described. For example, in the case of a simple transition condition, a description using a logical expression is appropriate. In the process of determining the transition condition, when a calculation of a plurality of steps is necessary, the description by the determination function is appropriate. In the case of transition conditions that require complicated comparison operations or logical operations, description using a logic circuit is appropriate. By selecting an appropriate description format, input errors of the developer are reduced, and the quality of the generated program is improved.

また、選択された記述形式に適した構造をもつソースコードが自動的に生成される。例えば、論理式の場合、関数呼び出しを行わずに条件分岐文の中で直接条件判定を行うようにすることで、プログラムの処理効率が向上する。したがって、高い処理効率が求められるソフトウェアを開発する場合にも、ソースコード生成装置を使用することができ、開発効率が大幅に向上する。   In addition, source code having a structure suitable for the selected description format is automatically generated. For example, in the case of a logical expression, the processing efficiency of a program is improved by performing a conditional determination directly in a conditional branch statement without calling a function. Therefore, even when developing software that requires high processing efficiency, the source code generation device can be used, and development efficiency is greatly improved.

なお、上記説明において図5に遷移条件の記述形式の選択画面例を示したが、この選択画面例と異なる構成の選択画面も考えられる。
図11は、遷移条件の記述形式の選択画面の他の例を示す図である。選択画面25は、入力領域25a,25b、選択領域25cおよびボタン25dを有する。入力領域25a,25bおよびボタン25dの機能は、選択画面21における入力領域21a,21bおよびボタン21dの機能とそれぞれ同一である。選択領域25cは、遷移条件の記述形式を1つ選択するための選択領域である。選択画面21の選択領域21cはラジオボタン形式を用いているが、選択領域25cはプルダウン形式を用いている。プルダウン形式にすることで、より小さい画面領域で選択領域を構成することができる。
In the above description, FIG. 5 shows a selection screen example of the transition condition description format, but a selection screen having a configuration different from this selection screen example is also conceivable.
FIG. 11 is a diagram showing another example of the transition condition description format selection screen. The selection screen 25 has input areas 25a and 25b, a selection area 25c, and a button 25d. The functions of the input areas 25a and 25b and the button 25d are the same as the functions of the input areas 21a and 21b and the button 21d on the selection screen 21, respectively. The selection area 25c is a selection area for selecting one transition condition description format. The selection area 21c of the selection screen 21 uses a radio button format, but the selection area 25c uses a pull-down format. By using the pull-down format, the selection area can be configured with a smaller screen area.

また、本実施の形態ではC言語で記述されたソースコードを生成したが、本実施の形態に係るソースコード生成装置は、さまざまなプログラミング言語への応用が可能である。生成されるソースコードの記述は汎用的な内容であり、さまざまな分野のソフトウェア開発に適用することができる。さらに、本実施の形態では、遷移条件の記述形式を3つの記述形式の中から選択できるようにしたが、これ以外の記述形式を選択できるように拡張することも容易である。   Further, although the source code described in the C language is generated in the present embodiment, the source code generation device according to the present embodiment can be applied to various programming languages. The description of the generated source code has general contents and can be applied to software development in various fields. Furthermore, in the present embodiment, the transition condition description format can be selected from three description formats. However, it is easy to expand so that other description formats can be selected.

以上、本発明のソースコード生成装置、ソースコード生成方法およびソースコード生成プログラムを、図示の実施の形態に基づいて説明したが、本発明はこれに限定されるものではなく、各部の構成は、同様の機能を有する任意の構成のものに置換することができる。また、本発明に、他の任意の構成物や工程が付加されていてもよい。   As described above, the source code generation device, the source code generation method, and the source code generation program of the present invention have been described based on the illustrated embodiment, but the present invention is not limited to this, and the configuration of each unit is as follows. Any structure having a similar function can be substituted. Moreover, other arbitrary structures and processes may be added to the present invention.

また、本発明は、前述した実施の形態のうちの、任意の2以上の構成(特徴)を組み合わせたものであってもよい。
なお、上記の処理機能は、コンピュータによって実現することができる。その場合、ソースコード生成装置100が有すべき機能の処理内容を記述したプログラムが提供される。そのプログラムをコンピュータで実行することにより、上記処理機能がコンピュータ上で実現される。処理内容を記述したプログラムは、コンピュータで読み取り可能な記録媒体に記録しておくことができる。コンピュータで読み取り可能な記録媒体としては、例えば、磁気記録装置、光ディスク、光磁気記録媒体、半導体メモリなどが挙げられる。磁気記録装置としては、例えば、ハードディスク装置(HDD)、フレキシブルディスク(FD)、磁気テープなどが挙げられる。光ディスクとしては、例えば、DVD(Digital Versatile Disc)、DVD−RAM、CD−ROM(Compact Disc Read Only Memory)、CD−R(Recordable)/RW(ReWritable)などが挙げられる。光磁気記録媒体としては、例えば、MO(Magneto-Optical disk)などが挙げられる。
In addition, the present invention may be a combination of any two or more configurations (features) of the above-described embodiments.
The above processing functions can be realized by a computer. In that case, a program describing the processing content of the function that the source code generation device 100 should have is provided. By executing the program on a computer, the above processing functions are realized on the computer. The program describing the processing contents can be recorded on a computer-readable recording medium. Examples of the computer-readable recording medium include a magnetic recording device, an optical disk, a magneto-optical recording medium, and a semiconductor memory. Examples of the magnetic recording device include a hard disk device (HDD), a flexible disk (FD), and a magnetic tape. Examples of the optical disc include a DVD (Digital Versatile Disc), a DVD-RAM, a CD-ROM (Compact Disc Read Only Memory), and a CD-R (Recordable) / RW (ReWritable). Examples of the magneto-optical recording medium include an MO (Magneto-Optical disk).

プログラムを流通させる場合には、例えば、そのプログラムが記録されたDVD、CD−ROMなどの可搬型記録媒体が販売される。また、プログラムをサーバコンピュータの記憶装置に格納しておき、ネットワークを介して、サーバコンピュータから他のコンピュータにそのプログラムを転送することもできる。   When distributing the program, for example, portable recording media such as a DVD and a CD-ROM on which the program is recorded are sold. It is also possible to store the program in a storage device of a server computer and transfer the program from the server computer to another computer via a network.

ソースコード生成プログラムを実行するコンピュータは、例えば、可搬型記録媒体に記録されたプログラムもしくはサーバコンピュータから転送されたプログラムを、自己の記憶装置に格納する。そして、コンピュータは、自己の記憶装置からプログラムを読み取り、プログラムに従った処理を実行する。なお、コンピュータは、可搬型記録媒体から直接プログラムを読み取り、そのプログラムに従った処理を実行することもできる。また、コンピュータは、サーバコンピュータからプログラムが転送されるごとに、逐次、受け取ったプログラムに従った処理を実行することもできる。   A computer that executes a source code generation program stores, for example, a program recorded on a portable recording medium or a program transferred from a server computer in its own storage device. Then, the computer reads the program from its own storage device and executes processing according to the program. The computer can also read the program directly from the portable recording medium and execute processing according to the program. Further, each time the program is transferred from the server computer, the computer can sequentially execute processing according to the received program.

実施の形態に適用される発明の概念図である。It is a conceptual diagram of the invention applied to embodiment. ソースコード生成装置のハードウェア構成を示す図である。It is a figure which shows the hardware constitutions of a source code production | generation apparatus. ソースコード生成装置の機能を示すブロック図である。It is a block diagram which shows the function of a source code production | generation apparatus. ソースコードの生成に使用される状態遷移図の例である。It is an example of a state transition diagram used for generating source code. 遷移条件の記述形式の選択画面例を示す図である。It is a figure which shows the example of a selection screen of the description format of a transition condition. 論理式形式による遷移条件の入力画面例を示す図である。It is a figure which shows the example of an input screen of the transition conditions by a logical formula form. 判定関数形式による遷移条件の入力画面例を示す図である。It is a figure which shows the example of an input screen of the transition condition by a determination function format. 論理回路形式による遷移条件の入力画面例を示す図である。It is a figure which shows the example of an input screen of the transition condition by a logic circuit format. ソースコード生成処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a source code production | generation process. 生成されるソースコード例を示す図である。It is a figure which shows the example of the source code produced | generated. 遷移条件の記述形式の選択画面の他の例を示す図である。It is a figure which shows the other example of the selection screen of the description format of a transition condition.

符号の説明Explanation of symbols

2 状態遷移図
2a,2b 状態
2c 状態遷移
3 入出力装置
4 遷移条件情報
5 ソースコード
10 ソースコード生成装置
11 状態遷移図記憶手段
12 入力画面表示手段
13 遷移条件情報取得手段
14 ソースコード生成手段
14a,14b,14c 判定コード生成機能
2 state transition diagram 2a, 2b state 2c state transition 3 input / output device 4 transition condition information 5 source code 10 source code generation device 11 state transition diagram storage unit 12 input screen display unit 13 transition condition information acquisition unit 14 source code generation unit 14a , 14b, 14c Judgment code generation function

Claims (6)

状態遷移図からプログラムのソースコードを生成するソースコード生成装置において、
プログラムの状態と前記状態間の状態遷移の関係とを記述した状態遷移図を記憶する状態遷移図記憶手段と、
前記状態遷移図記憶手段に記憶された前記状態遷移図の前記状態遷移それぞれについて、前記状態遷移が生起する条件を示す遷移条件の記述形式を、予め設定された複数の前記記述形式の一覧から選択させる選択領域と、選択された前記記述形式に従って前記遷移条件を記述するための記述領域とを備える入力画面を表示する入力画面表示手段と、
前記入力画面表示手段で表示した前記入力画面に対する操作入力を受け付け、選択された前記記述形式の情報と前記遷移条件の記述とを備える遷移条件情報を取得する遷移条件情報取得手段と、
前記入力画面で選択可能な前記記述形式それぞれに対応付けて、前記記述形式に従って記述された前記遷移条件から条件判定を行う判定コードを生成する判定コード生成機能を有しており、前記遷移条件情報取得手段が前記状態遷移図記憶手段に記憶された前記状態遷移図のすべての前記状態遷移について前記遷移条件情報を取得すると、前記状態遷移ごとに前記遷移条件情報で示される前記記述形式に対応する前記判定コード生成機能を呼び出して前記判定コードを生成すると共に、前記状態遷移図から前記条件判定以外の処理を記述した処理コードを生成し、生成した前記処理コードとすべての前記判定コードとを合成してプログラムのソースコードを出力するソースコード生成手段と、
を有することを特徴とするソースコード生成装置。
In a source code generation device that generates a source code of a program from a state transition diagram,
State transition diagram storage means for storing a state transition diagram describing the state of the program and the state transition relationship between the states;
For each of the state transitions of the state transition diagram stored in the state transition diagram storage means, select a transition condition description format indicating a condition under which the state transition occurs from a list of a plurality of preset description formats. An input screen display means for displaying an input screen comprising a selection area to be described, and a description area for describing the transition condition according to the selected description format;
Transition condition information acquisition means for receiving an operation input for the input screen displayed by the input screen display means and acquiring transition condition information including the selected description format information and the description of the transition condition;
A determination code generating function for generating a determination code for performing a condition determination from the transition condition described according to the description format in association with each description format selectable on the input screen; When the acquisition unit acquires the transition condition information for all the state transitions of the state transition diagram stored in the state transition diagram storage unit, the state corresponds to the description format indicated by the transition condition information for each state transition Call the determination code generation function to generate the determination code, generate a processing code describing processing other than the condition determination from the state transition diagram, and synthesize the generated processing code and all the determination codes Source code generation means for outputting the source code of the program,
A source code generation device comprising:
前記入力画面の前記選択領域は、真偽の判定が可能な論理式の形式を、選択可能な前記記述形式の1つとして有しており、
前記ソースコード生成手段が有する、前記論理式の形式に対応する前記判定コード生成機能は、入力として与えられた前記論理式が埋め込まれた条件分岐文のコードを、前記判定コードとして生成する、
ことを特徴とする請求項1記載のソースコード生成装置。
The selection area of the input screen has, as one of the description formats that can be selected, a logical expression format that can be determined as true or false.
The determination code generation function corresponding to the format of the logical expression that the source code generation means has generates a code of a conditional branch statement in which the logical expression given as an input is embedded as the determination code.
The source code generation device according to claim 1.
前記入力画面の前記選択領域は、戻り値として真偽の判定結果を返す判定関数の形式を、選択可能な前記記述形式の1つとして有しており、
前記ソースコード生成手段が有する、前記判定関数の形式に対応する前記判定コード生成機能は、入力として与えられた前記判定関数と、前記判定関数を呼び出す関数呼び出し文が埋め込まれた条件分岐文とを備えるコードを、前記判定コードとして生成する、
ことを特徴とする請求項1記載のソースコード生成装置。
The selection area of the input screen has, as one of the selectable description formats, a determination function format that returns a true / false determination result as a return value,
The determination code generation function corresponding to the determination function format included in the source code generation means includes the determination function given as an input and a conditional branch statement in which a function call statement for calling the determination function is embedded. A code provided is generated as the determination code;
The source code generation device according to claim 1.
前記入力画面の前記選択領域は、真偽の判定が可能な論理回路の形式を、選択可能な前記記述形式の1つとして有しており、
前記ソースコード生成手段が有する、前記論理回路の形式に対応する前記判定コード生成機能は、入力として与えられた前記論理回路を同等の意味をもつ論理式に変換すると共に、変換した前記論理式に基づいて真偽を判定し戻り値として判定結果を返す判定関数と、前記判定関数を呼び出す関数呼び出し文が埋め込まれた条件分岐文とを備えるコードを、前記判定コードとして生成する、
ことを特徴とする請求項1記載のソースコード生成装置。
The selection area of the input screen has, as one of the description formats that can be selected, a logic circuit format capable of authenticity determination.
The determination code generation function corresponding to the format of the logic circuit included in the source code generation unit converts the logic circuit given as input into a logical expression having an equivalent meaning, and converts the logical circuit into the converted logical expression. Generating a code including a determination function that determines true / false based on which a determination function returns a determination result as a return value and a conditional branch statement in which a function call statement that calls the determination function is embedded, as the determination code;
The source code generation device according to claim 1.
プログラムの状態と前記状態間の状態遷移の関係とを記述した状態遷移図からプログラムのソースコードを生成するソースコード生成方法において、
入力画面表示手段が、状態遷移図記憶手段に記憶された前記状態遷移図の前記状態遷移それぞれについて、前記状態遷移が生起する条件を示す遷移条件の記述形式を、予め設定された複数の前記記述形式の一覧から選択させる選択領域と、選択された前記記述形式に従って前記遷移条件を記述するための記述領域とを備える入力画面を表示し、
遷移条件情報取得手段が、前記入力画面表示手段で表示した前記入力画面に対する操作入力を受け付け、選択された前記記述形式の情報と前記遷移条件の記述とを備える遷移条件情報を取得し、
ソースコード生成手段が、前記入力画面で選択可能な前記記述形式それぞれと対応付けて、前記記述形式に従って記述された前記遷移条件から条件判定を行う判定コードを生成する判定コード生成機能を有しており、前記遷移条件情報取得手段が前記状態遷移図記憶手段に記憶された前記状態遷移図のすべての前記状態遷移について前記遷移条件情報を取得すると、前記状態遷移ごとに前記遷移条件情報で示される前記記述形式に対応する前記判定コード生成機能を呼び出して前記判定コードを生成すると共に、前記状態遷移図から前記条件判定以外の処理を記述した処理コードを生成し、生成した前記処理コードとすべての前記判定コードとを合成してプログラムのソースコードを出力する、
ことを特徴とするソースコード生成方法。
In a source code generation method for generating a program source code from a state transition diagram describing a state of a program and a relationship of state transitions between the states,
The input screen display means has a plurality of descriptions described in advance in a transition condition description format indicating a condition in which the state transition occurs for each of the state transitions of the state transition diagram stored in the state transition diagram storage means. An input screen comprising a selection area to be selected from a list of formats and a description area for describing the transition condition according to the selected description format;
The transition condition information acquisition means receives an operation input for the input screen displayed by the input screen display means, acquires transition condition information including information on the selected description format and a description of the transition condition,
Source code generation means has a determination code generation function for generating a determination code for performing condition determination from the transition conditions described according to the description format in association with each description format selectable on the input screen. When the transition condition information acquisition unit acquires the transition condition information for all the state transitions of the state transition diagram stored in the state transition diagram storage unit, the transition condition information is indicated by the transition condition information for each state transition. The determination code generation function corresponding to the description format is called to generate the determination code, and a processing code describing processing other than the condition determination is generated from the state transition diagram, and the generated processing code and all of the processing codes are generated. Combining the determination code and outputting the source code of the program;
A source code generation method characterized by the above.
状態遷移図からプログラムのソースコードを生成するソースコード生成プログラムにおいて、
コンピュータを、
プログラムの状態と前記状態間の状態遷移の関係とを記述した状態遷移図を記憶する状態遷移図記憶手段、
前記状態遷移図記憶手段に記憶された前記状態遷移図の前記状態遷移それぞれについて、前記状態遷移が生起する条件を示す遷移条件の記述形式を、予め設定された複数の前記記述形式の一覧から選択させる選択領域と、選択された前記記述形式に従って前記遷移条件を記述するための記述領域とを備える入力画面を表示する入力画面表示手段、
前記入力画面表示手段で表示した前記入力画面に対する操作入力を受け付け、選択された前記記述形式の情報と前記遷移条件の記述とを備える遷移条件情報を取得する遷移条件情報取得手段、
前記入力画面で選択可能な前記記述形式それぞれに対応して、前記記述形式に従って記述された前記遷移条件から条件判定を行う判定コードを生成する判定コード生成機能を有しており、前記遷移条件情報取得手段が前記状態遷移図記憶手段に記憶された前記状態遷移図のすべての前記状態遷移について前記遷移条件情報を取得すると、前記状態遷移ごとに前記遷移条件情報で示される前記記述形式に対応する前記判定コード生成機能を呼び出して前記判定コードを生成すると共に、前記状態遷移図から前記条件判定以外の処理を記述した処理コードを生成し、生成した前記処理コードとすべての前記判定コードとを合成してプログラムのソースコードを出力するソースコード生成手段、
として機能させることを特徴とするソースコード生成プログラム。
In a source code generation program that generates a program source code from a state transition diagram,
Computer
State transition diagram storage means for storing a state transition diagram describing the state of the program and the state transition relationship between the states;
For each of the state transitions of the state transition diagram stored in the state transition diagram storage means, select a transition condition description format indicating a condition under which the state transition occurs from a list of a plurality of preset description formats. An input screen display means for displaying an input screen comprising a selection area to be described and a description area for describing the transition condition according to the selected description format;
Transition condition information acquisition means for receiving an operation input to the input screen displayed by the input screen display means, and acquiring transition condition information including the selected description format information and the transition condition description;
Corresponding to each of the description formats selectable on the input screen, it has a determination code generation function for generating a determination code for performing a condition determination from the transition conditions described according to the description format, and the transition condition information When the acquisition unit acquires the transition condition information for all the state transitions of the state transition diagram stored in the state transition diagram storage unit, the state corresponds to the description format indicated by the transition condition information for each state transition Call the determination code generation function to generate the determination code, generate a processing code describing processing other than the condition determination from the state transition diagram, and synthesize the generated processing code and all the determination codes Source code generation means for outputting the source code of the program,
A source code generation program characterized by functioning as
JP2006124687A 2006-04-28 2006-04-28 Source code generation apparatus, source code generation method, and source code generation program Expired - Fee Related JP4670724B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006124687A JP4670724B2 (en) 2006-04-28 2006-04-28 Source code generation apparatus, source code generation method, and source code generation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006124687A JP4670724B2 (en) 2006-04-28 2006-04-28 Source code generation apparatus, source code generation method, and source code generation program

Publications (2)

Publication Number Publication Date
JP2007299082A true JP2007299082A (en) 2007-11-15
JP4670724B2 JP4670724B2 (en) 2011-04-13

Family

ID=38768539

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006124687A Expired - Fee Related JP4670724B2 (en) 2006-04-28 2006-04-28 Source code generation apparatus, source code generation method, and source code generation program

Country Status (1)

Country Link
JP (1) JP4670724B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04352029A (en) * 1991-05-29 1992-12-07 Hitachi Ltd Automatic formation device for source program
JPH07225783A (en) * 1993-05-06 1995-08-22 Matsushita Electric Ind Co Ltd Function design support device and method therefor
JPH08286899A (en) * 1995-04-18 1996-11-01 Hitachi Ltd Program composition by using display screen state transition table
JP2003076543A (en) * 2001-08-31 2003-03-14 Cats Kk Device, method for generating program and program for making computer execute the same program
JP2006012017A (en) * 2004-06-29 2006-01-12 Denso Corp Program generation program, program generation device and program generation method for generating program based on correspondence information in which actions are assigned to states, and program, device and method for generating the correspondence information

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04352029A (en) * 1991-05-29 1992-12-07 Hitachi Ltd Automatic formation device for source program
JPH07225783A (en) * 1993-05-06 1995-08-22 Matsushita Electric Ind Co Ltd Function design support device and method therefor
JPH08286899A (en) * 1995-04-18 1996-11-01 Hitachi Ltd Program composition by using display screen state transition table
JP2003076543A (en) * 2001-08-31 2003-03-14 Cats Kk Device, method for generating program and program for making computer execute the same program
JP2006012017A (en) * 2004-06-29 2006-01-12 Denso Corp Program generation program, program generation device and program generation method for generating program based on correspondence information in which actions are assigned to states, and program, device and method for generating the correspondence information

Also Published As

Publication number Publication date
JP4670724B2 (en) 2011-04-13

Similar Documents

Publication Publication Date Title
JP4280759B2 (en) Information processing apparatus and user interface control method
US20110126171A1 (en) Dynamic native editor code view facade
US10884711B2 (en) Code management system and code management method using a visual programming tool
JP2006301989A (en) Method, apparatus and program for automatically generating program in computer language from block diagram
JP4702194B2 (en) Program development support apparatus, program development support method, and program development support program
WO2007116490A1 (en) Source code generation program, source code generation method, and source code generation device
JP2004070810A (en) Visual programming system, visual programming method, program for visual programming, and storage medium containing the program
JP2009129327A (en) Program development support device, method, and program
JP4670724B2 (en) Source code generation apparatus, source code generation method, and source code generation program
JP2007011507A (en) Display method of program tree and program generation system
JP4848772B2 (en) Program generating apparatus and program generating program
JP2007287025A (en) Method and apparatus for creating screen transition program
JP2005031737A (en) System, method, and program for generating source code, and software development support tool
JP5399601B2 (en) Implementation code development system and implementation code development program
JP2006293436A (en) Program code generation device and generation method
US20130093645A1 (en) Computer-readable recording medium, apparatus, and method for creating setting information
JP2008107982A (en) Development support program, development support method, and development support device
JP2001273125A (en) Method and system for automatically generating source program, and program recording medium therefor
JP3940922B2 (en) Software code generation device, software code generation method, recording medium, and program
US7683902B1 (en) Method to visualize performance data of a multi-layered state diagram
JP4590907B2 (en) Software development support device and software development support program
JP2002287964A (en) Screen input/output specification designing system, method and program
KR100836218B1 (en) The method and apparatus for automation to manage features of product line system
JP5629355B1 (en) Source program generation device and source program generation program
JPH10105387A (en) Sdl/program code mutual conversion system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090313

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20101221

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110103

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20140128

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140128

Year of fee payment: 3

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

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

Free format text: PAYMENT UNTIL: 20140128

Year of fee payment: 3

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees